简体   繁体   中英

How to push changes to github

I designing my web app and now I want to push the changes to my repo.

I tried git push orgin master and entered my userame/password correctly and recieved this error:

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/username/project.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.

So I tried git pull orgin master (which successfully downloaded the changes added by another user) and then I re-tried git push orgin master and the same result. Again.

I also tried

git init
git add .
git commit -m "Styled notifications"

The only explanation for this which comes to mind is that someone else pushed new commits to the remote master branch between the time you pulled and pushed. Can you try the following two commands in rapid succession:

git pull origin master
git push origin master

Note that git pull will merge the remote's changes into your local branch, but an alternative to this would be to rebase instead:

git pull --rebase origin master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM