git rejected push non-fast-forward

前端 未结 7 468
情书的邮戳
情书的邮戳 2020-12-08 17:03

I am quite new to git, and I had been working on a small side project for the last 2 months and had been pushing stuff onto bitbucket with no problems. A couple of days ago,

相关标签:
7条回答
  • works for me git push --set-upstream origin master -f

    0 讨论(0)
  • 2020-12-08 17:07

    in my case was new file from git repository not added, and this was the solution 1. git status (just to check) 2. git add . 3. git push -u master origin

    0 讨论(0)
  • 2020-12-08 17:09

    I had the exact same problem. Nothing helped untill I tried this:

    git pull --rebase origin master

    After that, run push command i.e.

    git push -u origin master

    SOLVED FOR ME!!

    0 讨论(0)
  • There are changes in the central repository that you must pull before you can push. Do

    git add -A
    git commit -m "my local changes" 
    git pull
    

    Resolve any conflicts. Then do

    git push
    

    Alternatively, if you have no valuable modifications locally, you can create a new clone of your repo, and start working from there:

    git clone https://johnsproject@bitbucket.org/johnsproject/proj.git new_repo_dir
    
    0 讨论(0)
  • 2020-12-08 17:20

    Try doing

    git pull origin master
    git add -A
    git commit -m "modified code"
    git push origin master
    

    Your local repository is likely out of sync with the remote repository.

    0 讨论(0)
  • 2020-12-08 17:27

    You can try git pull, after that git commit in studio, and after that git push origin branch name.

    0 讨论(0)
提交回复
热议问题