1026
1026

Reputation: 1

Why I am getting Updates were rejected because the tip of your current branch is behind message even though I am pushing to a new repo just created

  1. I Just created the new repository in Azure DevOps
  2. I tried to pushed my project from the local computer and getting error message "Updates were rejected because the tip of your current branch is behind"

I am assuming that I am getting this message because one commit is created (Added README.md, .gitignore files) automatically when I created the new repository on Azure Devops remote repository.

How can I push it to the remote repository?

I did fetch command but still getting the same message and cannot push. Note: I am the only one working for the new repository and nobody touches or push it.

Upvotes: 0

Views: 966

Answers (1)

Lajos Arpad
Lajos Arpad

Reputation: 76414

Your assumption is correct. The existence of the commit on the other repo which does not exist at your end is the problem. You can do one of the following:

git push -f origin master

will force-push your changes.

git pull

from the remote will solve your problem, you will need to solve the merge conflicts then.

You can also solve it with git rebase. Finally, you can simply remove the latest commit on your remote.

Upvotes: 0

Related Questions