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

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

我正在将我的主分支推送到我的 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 中的主分支还是某个克隆?

非常感谢

And it worked but said

分支主管设置为从源头跟踪远程分支主管。

执行 git 配置 --local -l

您会看到本地分支 master 设置为跟踪 upstream branch origin/master

参见“Difference between git checkout --track origin/branch and git checkout -b branch origin/branch”。

就像你做的那样:

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

第一个 推送需要上游信息:参见“Why do I need to explicitly push a new branch?”。

我在执行 git pull <branch> 时遇到了同样的错误,我通过将其更改为 git pull origin <branch> 来修复它。