|NO.Z.00005|——————————|^^ 配置 ^^|——|CI/CD&Git配置.V04|——|SSH连接|

一、SSH连接
### --- SSH连接

~~~     客户机上产生公钥上传到gitlab的SSH-Keys里,
~~~     git clone下载和git push上传都没问题,这种方式很安全
二、http 链接(两种方式实现)
### --- 配置http连接
~~~     查看git.http配置信息

[root@server12 ~]# cd .git
[root@server12 ~]# cat config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://username:password@qfedu.com@172.17.0.39:sauser/ansible.git
[branch "master"]
remote = origin
merge = refs/heads/master
三、登录Git账户
### --- cd到根目录,执行
~~~     执行之后会在.gitconfig文件中多添加以下选项
                 
[root@server12 ~]# git config --global credential.helper store 
  [credential]        
          helper = store
### --- cd到项目目录,执行git pull命令,会提示输入账号密码。
~~~     输完这一次以后就不再需要,并且会在根目录生成一个.git-credentials文件

[root@server12 ~]# git pull
  Username for 'http://172.17.0.39:sauser/ansible.git':
  xxxx@xxxx.com Password for 'https://xxxx@xxxx.com@172.17.0.39:sauser/ansible.git':
### --- 之后pull/push代码都不再需要输入账号密码了

[root@server12 ~]# cat .git-credentials
  https://Username:Password@qfedu.com.oschina.net
四、设置身份验证
### --- 设置身份验证
~~~     **注意:**设定本机用户名,绑定邮箱,让远程服务器知道机器的身份

[root@server12 ~]# git config --global user.name "user_name"
[root@server12 ~]# git config --global user.email "XXXXX@XX.com"

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(19)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示