! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://(my remote name & repo name).git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
If you have code on your local machine that is not under source control, you can put it under source control and import it into Bitbucket Server.
Assuming you have Git installed on your local machine, then:
Initialize the project by running the following commands in the terminal:
git init git add --all git commit -m "Initial Commit"
Push your files to the repository by running the following commands in the terminal (change the URL accordingly):
git remote add origin https://firstname.lastname@example.org:7999/yourproject/repo.git git push -u origin master
Any help would be greatly appreciated..
Hi, welcome to the Community!
This is probably caused because a 'readme.md' file was created on Bitbucket Server and it doesn't exist on your local repository yet, hence the message:
the remote contains work that you do not have locally.
To solve this, you can do a force push instead of the regular push, like this:
git push -f origin master
Keep in mind, though, that this will delete the 'readme.md' file from Bitbucket Server and you'll need to create it again later.
Hope that helps,
We created the Atlassian Authors program in 2019 to give more Community members the permissions to write Articles, along with the inspiration and tools to help them succeed. Since then, the program...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events