gitlab git clone 卡住_gitlab从入门到绝望
啥年月了還用svn,日了狗一樣難受。
開搞!
docker是最好的容器,直接docker裝gitlab。
學新玩意不去官網不是人:
https://docs.gitlab.com/omnibus/docker/#expose-gitlab-on-different-ports
docker pull gitlab/gitlab-ce
sudo docker run --detach \ ?--hostname gitlab.example.com \ ?--publish 443:443 --publish 80:80 --publish 22:22 \ ?--name gitlab \ ?--restart always \ ?--volume /srv/gitlab/config:/etc/gitlab \ ?--volume /srv/gitlab/logs:/var/log/gitlab \ ?--volume /srv/gitlab/data:/var/opt/gitlab \ ?gitlab/gitlab-ce:latest
官網上這樣說,可是他么的他報錯了真的報錯了:
cp: cannot create regular file '/etc/gitlab/gitlab.rb': Permission denied 。他說:掛載的本地目錄在容器中沒有執行權限
解決方案:加權限 ?--privileged=true 這個很有用在我的docker文章中也有遇到沒權限的情況,遇到沒權限先加一下試試。
我試了試,確實成功了。但是我想改端口!那么官老爺又說了:
For example, to expose the web interface on port?8929, and the SSH service on port?2289, use the following?docker run?command:
sudo docker run --detach \ ?--hostname gitlab.example.com \ ?--publish 8929:80 --publish 2289:22 \ ?--name gitlab \ ?--restart always \ ?--volume /srv/gitlab/config:/etc/gitlab \ ?--volume /srv/gitlab/logs:/var/log/gitlab \ ?--volume /srv/gitlab/data:/var/opt/gitlab \
--privileged=true\ ?gitlab/gitlab-ce:latest
(他又忘了加權限?或者按照官老爺說的這樣可以嗎
If you are on?SELinux?then run this instead:
sudo docker run --detach \--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab:Z \
--volume /srv/gitlab/logs:/var/log/gitlab:Z \
--volume /srv/gitlab/data:/var/opt/gitlab:Z \
gitlab/gitlab-ce:latest
)
Note:?The format for publishing ports is?hostPort:containerPort. Read more in Docker’s documentation about?exposing incoming ports.
(怎樣設置?
官網上往回看發現:
Configure GitLab
This container uses the official Omnibus GitLab package, so all configuration is done in the unique configuration file?/etc/gitlab/gitlab.rb.
To access GitLab’s configuration file, you can start a shell session in the context of a running container. This will allow you to browse all directories and use your favorite text editor:
sudo docker exec -it gitlab /bin/bashYou can also just edit?/etc/gitlab/gitlab.rb:
sudo docker exec -it gitlab editor /etc/gitlab/gitlab.rbOnce you open?/etc/gitlab/gitlab.rb?make sure to set the?external_url?to point to a valid URL.
可以繼續了
:)
Set?external_url:
# For HTTPexternal_url "http://gitlab.example.com:8929"
or
# For HTTPS (notice the https)
external_url "https://gitlab.example.com:8929"
For more information see the?NGINX documentation.
Set?gitlab_shell_ssh_port:
gitlab_rails['gitlab_shell_ssh_port'] = 2289Following the above example you will be able to reach GitLab from your web browser under?:8929?and push using SSH under the port?2289.
(我一直有個疑問,明明端口映射的是2289:22 ?映射的不是22嗎為什么還要這樣子:['gitlab_shell_ssh_port'] = 2289 ?
)然后重啟:
sudo docker restart gitlab
好像這樣也行:gitlab-ctl reconfigure
Note:?The initialization process may take a long time. You can track this process with the command?sudo docker logs -f gitlab
人家說初始化需要很長時間你可以看日志或者嗑瓜子
我是不停地賤賤的docker ps
看他一直在restaring。。。。。。盼星星盼月亮終于盼到health狀態
看招:
首頁點扳手可以創建用戶創建群組創建項目:
我創建了一個項目然后再加了一個readme初始化項目了。
然后貧僧先用http下載項目:
新建文件夾-> git->clone->那個地址
華麗的分割線
接下來講講用ssh,他們說用ssh方式更囂張
首先配置key
去git的安裝目錄找到usr/bin
C:\Program Files\Git\usr\bin然后地址欄輸入cmd彈出大黑框執行:
ssh-keygen -t rsa -C 'xxx@xxx.com'
一路牛b加閃電按回車在用戶目錄下C:\Users\sht\.ssh
生成了一個id_rsa.pub這個文件:
編輯器打開復制內容然后到gatlib的ssh秘鑰中添加
搞到那個大框框里面然后add成功之后去項目里面
復制新建文件夾clone直接ssh方式克隆,ohyes!
報錯了:
他說我沒權限,經鑒定是小王八git配置問題,我們來配置:
更改完clone:
gameover!
總結
以上是生活随笔為你收集整理的gitlab git clone 卡住_gitlab从入门到绝望的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 更姓改名什么意思?
- 下一篇: 都江堰向峨乡石花村房价多少钱一平方?