I have a local project that I have been using git for version control for. I would like to put this project on Bitbucket as a remote backup. I tried following the instructions in the documentation here . However, on the second step, "Change the remote URL on your local repo", I get the following error:
fatal: No such remote 'origin'
This would lead me to believe I've copied the URL from Bitbucket wrong, but I've tried to see how and I don't see anything wrong. It is of the form
Has anyone else encountered this and know how to fix it, or otherwise have helpful troubleshooting advice? Thanks!
I was able to figure out the solution to my own problem by reading more about the `git remote` options here . The issue is that the Bitbucket documentation tells you to use
git remote set-url <url>
whereas if you never had a remote origin for your local project you instead need to use
git remote add <url>
After doing it that way, it worked just fine, so if you run into this issue taking that approach might help you!.
PS: If you get
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://firstname.lastname@example.org/user/project.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.
you can fix this by changing
git push -u origin --all
from the documentation to
git push -u -f origin --all
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
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