您的位置:首页 > 其它

git向远程库推送文件的问题

2016-05-03 17:39 225 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/fangxuu/article/details/51306425

1.输入:git push -u origin master

错误信息:.Permanently added the RSA host key for IP address 'XXXXXXX' to the list of known hosts.

按照提示信息将IP加入到etc/hosts文件里面就行。

2.输入:$ Git remote add origin git@github.com:gitaccount/gitdemo.git

出错信息:fatal: remote origin already exists.

解决办法:输入: $ git remote rm origin

3.输入:$ git push -u origin master  

出错信息: ! [rejected] master -> master (fetch first)

error: failed to push some refs to 'git@github.com:fangxuu/learngit.git'

hint: Updates were rejected because the remote contains work that you do  

解决办法:输入:$ git pull --rebase origin master

按照出错提示用git pull命令即可。出现这个问题应该是我先在github上建立了仓库,再在本地建立仓库,这样github上的readme.md文件没有同步到本地。

好了,第一次添加远程库遇到的三个问题先写下来

输入:git push -u origin master

推送成功!有点开心。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: