GIT:致命:'master'似乎不是git存储库

时间:2015-04-23 04:51:32

标签: git git-push git-remote

我正在将我的主分支推送到我的GIT仓库并发生此错误

  fatal: 'master' does not appear to be a git repository

根据堆栈问题的建议我输入了

  git remote -v

得到了

  heroku    https://git.heroku.com/peaceful-cove-8372.git (fetch)
  heroku    https://git.heroku.com/peaceful-cove-8372.git (push)
  origin    https://github.com/SimonWalsh1000/breathe.git (fetch)
  origin    https://github.com/SimonWalsh1000/breathe.git (push)
然后我输入了

   simonalice$ git push -u origin master

它有效但是说

   Branch master set up to track remote branch master from origin.

我对GIT很新,我不完全确定发生了什么。如果有人能向我解释这个序列,我将非常感激。我一直无法得到明确的答案。现在是我的主分支,GIT的主分支还是克隆?

非常感谢

2 个答案:

答案 0 :(得分:5)

And it worked but said

Branch master set up to track remote branch master from origin.

Do a git config --local -l

You will see that the local branch master is set to track the upstream branch origin/master

See "Difference between git checkout --track origin/branch and git checkout -b branch origin/branch".

It would be like you did:

git config branch.master.remote origin
git config branch.master.merge refs/heads/branch

The first push needs that upstream information: see "Why do I need to explicitly push a new branch?".

答案 1 :(得分:0)

我在执行git pull <branch>时遇到相同的错误,并通过将其更改为git pull origin <branch>来解决了该错误。