嗨,我正在尝试通过 Git Bash 将文件从本地更新到位桶。当我尝试这个推荐时
$ git push -u origin 'master'
我收到类似
To https://test@bitbucket.org/test/a.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://test@bitbucket.org/test/a.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
请帮助我。我不知道为什么我会收到此错误。我是 git Bash 和位桶的初学者。请帮帮我?
您的local/master
不会使用 remote/master
更新。首先拉主,然后推。
$ git pull origin master
$ git push -u origin master
如果不起作用,请尝试变基原点/主站。
$ git pull --rebase origin master
正如您提到的(在评论中(,您在本地untracked files
。按照Add -> Commit -> Rebase -> Push
.
$ git add .
$ git commit -m 'added all'
$ git pull --rebase origin master
$ git push origin master