Cannot push to GitHub - keeps saying need merge

0 votes

Hi Guys,

I am new to Github. I am trying to push my code to Github. But it is showing me the below error.

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ''
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Jan 4 in Git & GitHub by akhtar
• 38,210 points

1 answer to this question.

0 votes


You can use the git pull origin master command before you push anything. I assume that you are using the origin as a name for your remote. You need to pull before the push, to make your local repository up-to-date before you push something (just in case someone else has already updated code on This helps in resolving conflicts locally.

answered Jan 4 by MD
• 95,300 points

Related Questions In Git & GitHub

0 votes
1 answer

I am not able to use pull, push, branch merge

Please execute the below command in the ...READ MORE

answered May 23, 2019 in Git & GitHub by Umer
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,890 points
0 votes
1 answer

Trying to analyse Sonarqube from in Github PRs

Just try the below steps.The DRONE_PULL_REQUEST environment variable has ...READ MORE

answered Jun 27, 2018 in Git & GitHub by shubham
• 7,320 points
0 votes
1 answer

How to perform a sonarqube analysis from in github?

DRONE_PULL_REQUEST  env variable holds the pull request ...READ MORE

answered Jul 6, 2018 in Git & GitHub by DareDev
• 6,890 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

How merge works in Git & GitHub!!!??

Hi@Hasid, In Git & GitHub merge concept comes ...READ MORE

answered Jan 31, 2020 in Git & GitHub by MD
• 95,300 points
+1 vote
1 answer

why we need to add at staging area before commit??

Hi@akhtar, The staging area is like a rough draft space, ...READ MORE

answered Jul 19, 2020 in Git & GitHub by MD
• 95,300 points