跟我一起用Git

来源:互联网 发布:可牛软件下载 编辑:程序博客网 时间:2024/06/10 21:58

写这篇博文的原因

  写这篇博文,是因为自己在使用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,就没有问题了:

这里写图片描述

0 0
原创粉丝点击