git上传仓库和问题

2019-08-05  本文已影响0人  丁先生_b64b

-b创建本地的新分支,-u origin创建仓库新分支,并把本地的分支推送到云端

一、https://blog.csdn.net/weixin_33699914/article/details/91314505

二、https://blog.csdn.net/lincyang/article/details/21519333

三、切换到分支报错:Your local changes to the following files would be overwritten by checkout:

      解决办法:    https://blog.csdn.net/qq_32452623/article/details/75645578

1. git add .

2. git commit -m 'XXX'

3. git push

提交push 报错:

$ git push origin master

Tohttps://gitee.com/xxx/******.git

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

error: failed to push some refs to 'https://gitee.com/xxx/******.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.

这是因为远程库里面有个文件,但是本地没有这个文件,完全提交上去会覆盖之前的文件(通常是因为远程库自动生成了一个REMAND.MD的文件原因,但是本地没有add到这个文件)

我们直接强制push 下就可以了:

$ git push -u origin master -f

上一篇 下一篇

猜你喜欢

热点阅读