Error...
! [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://username@your.bitbucket.domain: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,
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.