13.gitlab搭建仓库及联通Jenkins

时间:2021-09-04
本文章向大家介绍13.gitlab搭建仓库及联通Jenkins,主要包括13.gitlab搭建仓库及联通Jenkins使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

gitlab搭建仓库及联通Jenkins

gitlab创建仓库

Create blank project

仓库创建成功,有提示参考信息

gitlab配置SSH

git@192.168.222.128:root/gitlab_combat.git
git@gitee.com:gavinxiexingfu/test_combat.git

git remote rm origin

git remote -v

git关联多个仓库

git remote add gitlab git@192.168.222.128:9001/root/gitlab_combat.git
git remote add gitee git@gitee.com:gavinxiexingfu/test_combat.git

git push gitee master
git push gitlab master

git remote rm gitee
git remote rm gitlab

git remote add gitlab http://192.168.222.128:9001/root/gitlab_combat.git

git使用ssh推送到gitlab需要输入密码解决

使用ssh推送代码到gitlab报错:需要输入密码,不管输入什么都报错

$ git push gitlab master
git@192.168.222.128's password:
Permission denied, please try again.
git@192.168.222.128's password:
Permission denied, please try again.
git@192.168.222.128's password:
git@192.168.222.128: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决:Linux系统里面修改
修改gitlab的端口
文件:/etc/gitlab/gitlab.rb
修改
gitlab_rails['gitlab_shell_ssh_port'] = 8002

重新启动容器,启动成功,重新关联仓库
仓库地址自动带上ssh端口号
ssh://git@192.168.222.128:8022/root/gitlab_combat.git

gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)

 git remote add gitlab ssh://git@192.168.222.128:8022/root/gitlab_combat.git

$ git remote -v
gitee   git@gitee.com:gavinxiexingfu/test_combat.git (fetch)
gitee   git@gitee.com:gavinxiexingfu/test_combat.git (push)
gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (fetch)
gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (push)

gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
$ git push gitlab master
The authenticity of host '[192.168.222.128]:8022 ([192.168.222.128]:8022)' can't be established.
ECDSA key fingerprint is SHA256:Sq2//h6bepjalAUiqUUJlqcKcmJ2llQ2Bz6euw9f39E.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.222.128]:8022' (ECDSA) to the list of known hosts.
Everything up-to-date

参考资料:
https://www.it610.com/article/1281977795542532096.htm

原文地址:https://www.cnblogs.com/xiehuangzhijia/p/15225851.html