git首次提交 遇到的问题

//初始化
$git init
//添加提交文件 $git add
//提交 并备注 $git commit -m "first commit"
// 建立远程git仓库路径位置 $git remote add origin [email protected]:******.git
// 推送到主分支 $git push -u origin master
 
Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.

//执行最后一步可能遇到的问题,
大意就是为IP地址13.229.188.59的主机(RSA连接的)持久添加到hosts文件中,那就来添加吧!
 

linux环境  打开

vim /etc/hosts


添加一行:13.229.188.59  github.com

Windows环境:打开

C:\Windows\System32\drivers\etc\hosts

添加一行:13.229.188.59  github.com



Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.

//可能还不行 不要慌 向上面一样13.250.177.223 github.com 添加到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.

//原因:电脑公钥(publickey)未添加至github,所以无法识别。 因而需要获取本地电脑公钥,然后登录github账号,添加公钥至github就OK了

 

输入 ssh-keygen -t rsa 在按三次回车 就生成了本地电脑公匙 打开
/c/Users/Administrator/.ssh/id_rsa.pub 这个文件 复制内容到

打完收工,现在提交就成功了

 
 

猜你喜欢

转载自www.cnblogs.com/shaoping/p/10806151.html