跟我一起用Git

写这篇博文的原因

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

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值