Git Push Error | Bitbucket Repository

折月煮酒 提交于 2019-12-08 08:13:09

问题


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?


回答1:


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



回答2:


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




回答3:


You may try git push --mirror url-of-your-bitbucket-remote




回答4:


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


来源:https://stackoverflow.com/questions/15409841/git-push-error-bitbucket-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!