gitlab创建项目多人协同(三)
【摘要】
1.gitlab创建项目多人协同
1.1.新建一个项目并设置为开发1组权限
1.2.推送本地代码到gitlab
1)先将之前gitee的连接删掉
[root@gitlab data_git]# ...
1.gitlab创建项目多人协同
1.1.新建一个项目并设置为开发1组权限
1.2.推送本地代码到gitlab
1)先将之前gitee的连接删掉
[root@gitlab data_git]# git remote -v
origin git@gitee.com:jiang_xiao_long/git_test.git (fetch)
origin git@gitee.com:jiang_xiao_long/git_test.git (push)
[root@gitlab data_git]# git remote remove origin
2)将本地公钥填写到gitlab上实现免密登录
[root@gitlab data_git]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRPSxHx8JagN8aJX7NWzqnul76sA9mNw/kDfgOxlJIk0EoLj00BGzB/eDj+1XI4Tc02dq8layY/99pElGtYtxrn+t/62Fa7onIc+IBMYEAYlPkNDMl90V8n+cJOv+NUCnLDvzOy7P+m8JSicssXiqrJO3tJyud6OtcdprH55/kCuLlE9k+9Y/8PUXpJB3xtitrp2nfeY5R+6W8MCNUKOFLR63jLRZC7yAtcVKmLOvmGEyU2ezxxksGQFmvQ950Ta/KklHK+bbuTqJEkwfy6sM2YEt6KaxudJye28O/h59OExN4h4VzSfPVmXt48tnxn+ZHp5vcUcmHTaty3K4yl0gX root@gitlab
3)将gitlab地址添加到hosts文件解析
[root@gitlab data_git]# cat /etc/hosts
192.168.81.210 gitlab.jiangxl.com
4)将本地代码推送至gitlab仓库
[root@gitlab data_git]# git remote add origin git@gitlab.jiangxl.com:kaifa1zu/new_project.git
[root@gitlab data_git]# git push origin master
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
推送完成后
1.3.开发1组xiaoming进行协同工作
1)配置ssh免密登录
[root@192 ~]# ssh-keygen
[root@192 ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCj3tH1wPypDSGFECus9sYG5G82t1rpgacfXtsXa8XHQyCp5wbHPiUVn6Gh/P4UnYMYPWuZUv8XgKXSrK4GIOiS45g40Ik0demTnb1kqU7dfC+nvLchzQ7ScxjbdUYMZzqIAgCaNiW0w/ydzB5DrheLwPgiidoGp8rFZtRdyZwcjsbHT90hIq2n/yuDgzW7fxA4vuY57/sAfU2OzFg7Xe6IbypT29f0sRZBBNYKzBA5GF/MaDHQyqI2k9FK/E6nJGtJoPSqt2uS3ippty7kd++KJakaq2aw6EHYuqbhvE0qo3Sgj9Tdbch+6NX9O+ntF7QqnfttnE5UvP/KAkjb/S7j root@192.168.81.220
- 1
- 2
- 3
2)克隆gitlab代码到本地,进行修改再上传
1)克隆代码到本地
[root@192 data]# git clone git@gitlab.jiangxl.com:kaifa1zu/new_project.git
2)修改代码
[root@192 new_project]# cat xiaoming-file6
xiaoming
3)提交时本地仓库
[root@192 new_project]# git config --global user.name "xiaoming"
[root@192 new_project]# git config --global user.email xiaoming@qq.com
[root@192 new_project]# git add .
[root@192 new_project]# git commit -m "xiaoming-file6"
4)推送至远程仓库
[root@192 new_project]# git push origin master
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 280 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@gitlab.jiangxl.com:kaifa1zu/new_project.git
e7821a1..ec025b4 master -> master
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
3)gitlab本地查看
6[root@gitlab data_git]# git pull origin master
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
来自 gitlab.jiangxl.com:kaifa1zu/new_project
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
xiaoming-file6 | 1 +
1 file changed, 1 insertion(+)
create mode 100644 xiaoming-file6
[root@gitlab data_git]# cat xiaoming-file6
xiaoming
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
文章来源: jiangxl.blog.csdn.net,作者:Jiangxl~,版权归原作者所有,如需转载,请联系作者。
原文链接:jiangxl.blog.csdn.net/article/details/111174030
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)