您的位置:首页 > 其它

跟我一起用Git

2015-10-03 13:29 344 查看

写这篇博文的原因

  写这篇博文,是因为自己在使用Git的过程中,着实遇到了很多问题,现在记录下来,一是为了避免以后犯同样的错误,二是给其他人一些参考。

使用TortoiseGit

1.在有一次使用TortioseGit的过程中,我遇到了这样的问题:

Username for ‘https://github.com‘: dummymare

Password for ‘https://dummymare@github.com‘:

To https://github.com/dummymare/Hello-World.git

! [rejected] master -> master (fetch first)

error: failed to push some refs to ‘https://github.com/dummymare/Hello-World.git

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

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., ‘git pull …’) before pushing again.

hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

出现这种情况,一般是因为:本地版本和主干上的有差异。。。让你先pull远端的版本,解决了冲突才能push。比如说,当时我的情况是,在Github新建了一个代码库,同时初始化了一个README.MD,建好之后,我马上就从本地Push代码,就出现了这个问题。我的解决办法是,pull远端的README.MD,然后再Push,就没有问题了:

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