Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I cannot publish my Code with Visual Studio repository to Bitbucket

Nyein Chan Aung
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 1, 2020

First : I create respository on Bitbucket Cloud. 

Second : I publish the project code with visual studio with respectively URL from Bitbucket URL. 
I hit below issue: 

Error encountered while pushing branch to the remote repository: rejected Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes before pushing again.

 

How to fix it, Thanks.

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 16, 2020

Hi Nyein Chan Aung and welcome to the community!

The error message that you get indicates that the repository in Bitbucket Cloud contains commits that you do not have locally.

This may be the case

1. either because someone pushed commits to your repository that you do not have locally

2. or because you created a repository in Bitbucket Cloud including a README or .gitignore (these are options in the Create repository page) and then did not clone the repo containing this initial commit.

In this case, your new repository in Bitbucket Cloud will contain a first commit with the README or .gitignore. If you did not clone the repository locally, but you created a new local repo and you are trying to push its code to Bitbucket, then Git will complain because your local repo doesn't have the initial commit that your remote does.

The solution in either case should be pulling any changes from the remote repo first and then you should be able to push your changes.

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

proskilly
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2020

I have the same problem, the thing is the pull option is disabled in Visual Studio team explorer tab so i can't see how to do a pull before doing the push.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2020

Hi @proskilly ,

Does the branch you are working on in Visual studio have an upstream branch configured? If not, that may be a reason why the pull option is disabled. If the upstream branch is configured but you're still having issues with the button being disabled, you may want to reach to Visual Studio support team to figure out why this occurs.

Pulling changes is a common operation when you work on a repo along with other users who push to the branch(es) you are working on, so you need to have the ability to pull changes.

If you have Git Bash installed on your machine, you can navigate to the directory of your local repo, check out the branch you are working on, set the upstream branch with the command

git branch -u <remote>/<branch>

and then you should be able to pull changes with the command

git pull

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events