致命:不是 git 存储库(或任何父目录):.git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20413459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:26:12  来源:igfitidea点击:

fatal: Not a git repository (or any of the parent directories): .git

git

提问by user3072482

When I tried to push an existing repository on github.com, and it when I entered the command the website prompted me to put into the terminal, I got this error message fatal:

当我尝试在 github.com 上推送现有存储库时,当我输入命令时,网站提示我放入终端,我收到此错误消息致命:

Not a git repository (or any of the parent directories): .git

If anyone could help me with this, then that would be great, thanks.

如果有人可以帮助我解决这个问题,那就太好了,谢谢。

回答by Daniel Gratzer

The command has to be entered in the directory of the repository. The error is complaining that your current directory isn't a git repo

该命令必须输入到存储库的目录中。错误是抱怨您的当前目录不是 git repo

  1. Are you in the right directory? Does typing lsshow the right files?
  2. Have you initialized the repository yet? Typed git init? (git-init documentation)
  1. 你在正确的目录中吗?打字是否ls显示正确的文件?
  2. 您是否已初始化存储库?打字git init?(git-init 文档

Either of those would cause your error.

其中任何一个都会导致您的错误。