您好我正在尝试通过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和bit bucket的初学者。请帮帮我?
答案 0 :(得分:2)
您的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