-1

I tried to push code for the first time to the repository but its coming this error

    **! [rejected] master-> master (non -fast - forward)**

Is it because of git version or my installation issue?
Can any one tell me how to resolve this?

Laurent H.
  • 6,316
  • 1
  • 18
  • 40
Hemanth
  • 193
  • 1
  • 5
  • 18
  • Are you certain that the remote repository is bare? The error message indicates that there are one or more commits already there. – Tim Biegeleisen Jun 20 '18 at 05:43
  • If you created a new repository on github you might have accidentially created with a README and/or a LICENSE file, so the remote repo has a commit that you con't have locally. – pschichtel Jun 20 '18 at 09:14
  • Possible duplicate of [What does "Git push non-fast-forward updates were rejected" mean?](https://stackoverflow.com/questions/4684352/what-does-git-push-non-fast-forward-updates-were-rejected-mean) – phd Jun 20 '18 at 11:10

1 Answers1

0

It should not give this error if your branch is up to date with the remote master. Anyways, if you are very sure that nobody else is working on this repo/branch push your changes forcefully using below command

git push origin <my-feature-branch> -f
beingmanish
  • 1,040
  • 8
  • 21