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

来源:互联网 发布:英语同声传译软件 编辑:程序博客网 时间:2024/06/06 23:52

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 :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 ':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

推送成功!有点开心。

0 0
原创粉丝点击