2013-08-01 26 views
8

有什么方法可以在OpenShift中配置私人Git存储库?OpenShift上的私人Git

或者OpenShift不提供对Git存储库的外部访问?

+0

为什么我收到downvote? – Berneck

+0

“OpenShift中的私人github存储库”?你的意思是“OpenShift中的一个私人* git *存储库” – saeedgnu

+1

@ilius true,现在编辑。 –

回答

10

您需要执行以下步骤:

git clone <your-external-repo-url> 
change to newly cloned git directory 
git remote add openshift -f <openshift-git-repo-url> 
git merge openshift/master -s recursive -X ours 

git push openshift master 

这里的reference

+1

不用说''your-external-repo-url>'从'rhc show-app MYAPP | grep'Git URL:'' – saeedgnu

0

Akram Ben Aissi published an interesting post in the Openshift blog有关如何在Openshift V3部署Gitlab。

我看到它非常有用,如果有人正在寻找最近的更新或这个问题,也许可能会有趣。

很容易,创造postgress,Redis的和gitce并在最后3级新的应用程序添加持久卷:

PostgreSQL的:

oc new-app --template=postgresql-persistent \ 
-p POSTGRESQL_USER=admin,POSTGRESQL_PASSWORD=redhat,POSTGRESQL_DATABASE=gitlab 

Redis的

oc new-app sameersbn/redis 
oc volume dc/redis --add --overwrite -t persistentVolumeClaim \ 
        --claim-name=redis-data --name=redis-volume-1 \ 
        --mount-path=/var/lib/redis 

获取的Redis和postgresql服务IPs被传递给git-ce容器(在本例中为172.30.25.83,172.30.198.140)

oc get svc postgresql redis 

的Git-CE容器

oc new-app sameersbn/gitlab --name=gitlab-ce 
         -e 'GITLAB_HOST=http://gitlab.apps.mycompany.com' \ 
         -e 'DB_TYPE=postgres' -e 'DB_HOST=172.30.25.83' \ 
         -e 'DB_PORT=5432' -e 'DB_NAME=gitlab' -e 'DB_USER=admin' \ 
         -e 'DB_PASS=admin' -e 'REDIS_HOST=172.30.198.140 -e 'REDIS_PORT=6379' \ 
         -e 'GITLAB_SECRETS_DB_KEY_BASE=1234567890' -e 'SMTP_ENABLED=true' \ 
         -e 'SMTP_HOST=smtp.mycompany.com' -e 'SMTP_PORT=25' \ 
         -e '[email protected]' 

配置持久卷:

oc volumes dc/gitlab-ce --add --claim-name=gitlab-log --mount-path=/var/log/gitlab \ 
       -t persistentVolumeClaim --overwrite 
oc volumes dc/gitlab-ce --add --claim-name=gitlab-data --mount-path=/home/git/data \ 
       -t persistentVolumeClaim --overwrite 
+0

由于链接可能会随时间而改变,所以在您的回答中包含相关信息并提供上下文链接会更好。你能编辑你的答案吗?谢谢,欢迎来到StackOverflow。 –

0

你可以简单地做:

oc new-app http:<git url> 

如果您需要提供凭据Git仓库,然后这将需要更多的努力。您需要将与构建配置关联的访问权关联起来,详细信息请参阅here