简体   繁体   中英

“Not a git repository”

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" "--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 . The repo seems to behave properly when (in the correct directory) I do (for example):

$ git status

What is rev-parse doing and what do I have to do to my repo to make it work?

If git status is working then you must be in a non-bare repository with a working tree. git status requires a working tree.

If the program is running git --bare ... then it expects the given directory to be a bare git repository, ie with not working directory.

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.

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? `

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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