“不是 git 存储库”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1734327/
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
"Not a git repository"
提问by user147714
I am trying to use a program that uses git as the backing store (I am new to git). On initialization, this program does a:
我正在尝试使用一个使用 git 作为后备存储的程序(我是 git 新手)。初始化时,该程序执行以下操作:
"git" "--bare" "rev-parse" "refs/heads/index"
Which results in:
结果是:
fatal: Not a git repository: '/home/david/blog.git'
fatal: Not a git repository: '/home/david/blog.git'
I followed this tutorial, git init
, git add test.txt
and git commit
. The repo seems to behave properly when (in the correct directory) I do (for example):
我跟着这个教程,git init
,git add test.txt
和git commit
。当(在正确的目录中)我这样做时,repo 似乎表现得很好(例如):
$ git status
What is rev-parse
doing and what do I have to do to my repo to make it work?
我在rev-parse
做什么,我必须对我的 repo 做什么才能使它工作?
采纳答案by CB Bailey
If git status
is working then you must be in a non-bare repository with a working tree. git status
requires a working tree.
如果git status
正在工作,那么您必须位于具有工作树的非裸存储库中。git status
需要一个工作树。
If the program is running git --bare ...
then it expects the given directory to be a bare git repository, i.e. with not working directory.
如果程序正在运行,git --bare ...
那么它期望给定的目录是一个裸 git 存储库,即没有工作目录。
The naming convention of reponame.git
is usually reserved for bare repositores and non-bare repositories usually use a directory name of reponame
and contain a .git
subdirectory.
的命名约定reponame.git
通常是为裸存储库保留的,非裸存储库通常使用目录名称reponame
并包含.git
子目录。
If /home/david/blog.git
is actually a non-bare repository then it will have a .git
subdirectory. If this is the case you can probably point the program at /home/david/blog.git/.git
but I can't help feeling that it would be safer to point it at a truly bare repository. What program is it and what were the instructions for initializing its data store?
`
如果/home/david/blog.git
实际上是一个非裸存储库,那么它将有一个.git
子目录。如果是这种情况,您可能可以将程序指向,/home/david/blog.git/.git
但我不禁觉得将它指向真正的裸存储库会更安全。它是什么程序,初始化其数据存储的指令是什么?`
回答by CB Bailey
Maybe "git init" is all you need to do.
也许“git init”就是你需要做的。