We are trying to push our local contents to our repository in "Bitbucket" but we are getting the following error while trying to "git push" after committing our files.
Error Message
$ git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Can you people help us in this regards?
I just had the same problem, this may help you:
#initialize git in the folder
git init
#add remote repository (this did not work for me)
git remote add origin https://myusername@bitbucket.org/myusername/myrepo.git
#...so i changed it later (after some git add and commit commands)
git remote set-url origin https://myusername@bitbucket.org/myusername/myrepo.git
#now it worked:
git push -u origin master
If you get the error message remote origin already exists
, run this:
git remote rm origin
It looks very much like you have failed to run a git remote add
command.
Usually this would look like
git remote add origin ssh://git@bitbucket.org/[USERNAME]/[REPONAME].git
But you should be able to find the correct info for your repository if you follow the docs here: https://confluence.atlassian.com/display/BITBUCKET/Importing+code+from+an+existing+project
You may try git push --mirror url-of-your-bitbucket-remote
I mistakenly ran following with 'i' missing in origin.
git remote add orign url
Only find out when view it using below command
git remote -v
and remove it using
git remote remove orign
and created it again with correct spelling using
git remote add origin url