docker swarm + gitlab服务器中仓库项目下拉/上传代码的流程步骤
docker swarm集群之项目集成中gitlab仓库项目下拉到本地及修改代码后上传至gitlab服务器仓库中。
环境是之前的环境了,gitlab gitlab-runner 我都装好了
有兴趣的可以自行切换至本站docker分类查阅
话不多说直接登录gitlab服务器,直接创建项目仓库/或导入github上的开源项目都OK
我这就有一个hyperf2.1的项目,后面会迁移到docker swarm集群架构中
所以我就用hyperf框架的github链接导进来,如下图:
ps:
1.比较简单,都是图形化,具体过程就不过多描述;
2.语言切换,如果你看英文不习惯开源改成简体中文;
语言切换步骤:
点击右上角登录头像的位置->点击Preferences 弹出以下界面->选中简体中就OK了
使用git客户端把上面的仓库项目拉取到本地
我这是windows系统使用git客户端
1.新建文件夹demo,我这的路径是D:\swoole\demo
2.进入demo文件夹里面右击选择Git Bash Here 直接进人git命令行界面
[email protected] MINGW64 /d/swoole/demo
$ git init
Initialized empty Git repository in D:/swoole/demo/.git/
[email protected] MINGW64 /d/swoole/demo (master)
$ git remote add origin [email protected]:root/demo.git
[email protected] MINGW64 /d/swoole/demo (master)
$ git fetch origin master
The authenticity of host 'master (172.18.1.150)' can't be established.
ECDSA key fingerprint is SHA256:BcGim8yE1JxzWsXeie+gxnJCXlCH7CdVJ/USTbYC4Ok.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'master,172.18.1.150' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ps:
上面的报错是提示没有权限,
需要在gitlab服务器中添加ssh keys(没有就生成,我这里已经生成过了直接用)
1.复制里面的秘钥信息,在C:\Users\Administrator\.ssh\id_rsa.pub文件中
2.登录gitlab服务器
点击右上角登录头像的位置->点击Preferences->点击SSH Keys->弹出以下界面把刚复制的秘钥粘贴到key中->点击add key
我这里已经添加过了
上传代码至gitlab项目仓库master分支
[email protected] MINGW64 /d/swoole/demo (master)
$ git pull origin master
remote: Enumerating objects: 6885, done.
remote: Counting objects: 100% (6885/6885), done.
remote: Compressing objects: 100% (3609/3609), done.
remote: Total 6885 (delta 2897), reused 6877 (delta 2893), pack-reused 0
Receiving objects: 100% (6885/6885), 3.16 MiB | 11.10 MiB/s, done.
Resolving deltas: 100% (2897/2897), done.
From master:root/demo
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
新建test分支 合并至test分支
[email protected] MINGW64 /d/swoole/demo (master)
$ git branch test
[email protected] MINGW64 /d/swoole/demo (master)
$ git push origin test
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for test, visit:
remote: http://master/root/demo/-/merge_requests/new?merge_request%5Bsource_branch%5D=test
remote:
To master:root/demo.git
* [new branch] test -> test
修改本地代码,然后上传代码
[email protected] MINGW64 /d/swoole/demo (master)
$ git add .
[email protected] MINGW64 /d/swoole/demo (master)
$ git commit -m "提交信息23"
[master 0b82ee3] 提交信息23
1 file changed, 2 insertions(+), 2 deletions(-)
[email protected] MINGW64 /d/swoole/demo (master)
$ git push -u origin master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 335 bytes | 111.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To master:root/demo.git
c310810..0b82ee3 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
[email protected] MINGW64 /d/swoole/demo (master)
$
登录gitlab服务器看看刚上传的提交动态信息
相关文章