简体   繁体   English

“不是git存储库”

[英]“Not a git repository”

I am trying to use a program that uses git as the backing store (I am new to git). 我正在尝试使用一个使用git作为后备存储的程序(我是git的新手)。 On initialization, this program does a: 在初始化时,该程序执行以下操作:

"git" "--bare" "rev-parse" "refs/heads/index"

Which results in: 结果如下:

fatal: Not a git repository: '/home/david/blog.git'

I followed this tutorial , git init , git add test.txt and git commit . 我按照本教程git initgit add test.txtgit commit The repo seems to behave properly when (in the correct directory) I do (for example): 当我(在正确的目录中)(例如)时,repo似乎表现得正常:

$ git status

What is rev-parse doing and what do I have to do to my repo to make it work? 什么是rev-parse正在做什么以及我必须对我的回购做些什么才能使它工作?

If git status is working then you must be in a non-bare repository with a working tree. 如果git status正在运行,那么您必须位于具有工作树的非裸存储库中。 git status requires a working tree. git status需要一个工作树。

If the program is running git --bare ... then it expects the given directory to be a bare git repository, ie 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. 如果/home/david/blog.git实际上是非裸存储库,则它将具有.git子目录。 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. 如果是这种情况,您可以将程序指向/home/david/blog.git/.git但我不禁觉得将它指向真正的裸存储库更安全。 What program is it and what were the instructions for initializing its data store? 它是什么程序以及初始化其数据存储的说明是什么? ` `

也许“git init”就是你需要做的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM