git免密登录

查看~/.ssh目录下是否生成秘钥,有的话删除

1.重新生成秘钥

[root@db02 ~/.ssh]# ssh-keygen -t rsa -C "wcp@163.com"  

2.查看秘钥并且复制

[root@db02 ~/.ssh]# cat id_rsa.pub  

3.打开github或者你公司的git的网页,在Settings–>SSH keys中点击New SSH Keys把复制的秘钥粘贴并保存退出

4.找一目录执行

git init  #初始化git目录

5.添加远程仓库

[html] view plain copy
[root@db02 /test]# git remote add origin git@github.com:wcp-one/plugin.git 

6.添加用户信息

[root@db02 /test/plugin]# git config --global user.name "wcp-one"  
[root@db02 /test/plugin]# git config --global user.email "wcp@163.com"  

7.添加上传分支

[root@db02 /test/plugin]# git add open-falcon.sh   
[root@db02 /test/plugin]# git commit -m "init files"  

8.上传

[root@db02 /test/plugin]# git push -u origin master  

成功免密上传


报错及解决

[root@db02 /test/plugin]# git push origin master  
Warning: Permanently added the RSA host key for IP address '<span style="color:#ff6666;">13.229.188.59</span>' to the list of known hosts.  
<span style="color:#ff6666;">error</span>: src refspec master does not match any.  
<span style="color:#ff6666;">error</span>: failed to push some refs to 'git@github.com:wcp-one/plugin.git'  

1.在/etc/hosts下添加

13.229.188.59 github.com

2.添加上传信息参上


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值