使用Github遇到的问题及解决办法
问题一:
当push代码上去仓库时,出现
! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/Jierism/MyLocations.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by 。。。
解决:
1 git push -f 2 git pull 3 git config branch.master.remote origin 4 git config branch.master.merge refs/heads/master 5 git pull
详细参考:http://blog.csdn.net/chain2012/article/details/7476493
问题二:
push代码,插入注释git commit -m "注释语句"时,出现
On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean。。。
解决:
1 git pull --rebase
再继续push
问题三:
push代码,输入git remote add origin git@github.com:djqiang(github帐号名)/gitdemo(项目名).git,出现
fatal: remote origin already exists
解决:
1 git remote rm origin 2 接着再输入一次地址就OK