“不是git存储库” [英] "Not a git repository"

查看:213
本文介绍了“不是git存储库”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用一个使用git作为后备存储的程序(我是git的新手)。在初始化时,这个程序执行:

 git--barerev-parserefs / heads /索引

其中的结果是:

fatal:不是git仓库:'/home/david/blog.git'



我跟着本教程 git init git add test.txt git commit 。回购似乎在我(例如)(在正确的目录中)正确运行时:



pre $ code $ git status

什么是 rev-parse 在做什么和我有什么要做到我的回购使其工作?

解决方案

如果 git状态正在工作,那么你必须在一个非工作树的非裸仓库中。 git status 需要一个工作树。



如果程序正在运行 git --bare ... 然后它期望给定的目录是一个裸的git仓库,即不工作目录。



命名约定 reponame.git 通常用于裸存储,而非裸存储通常使用目录名称 reponame 并包含 .git 子目录。



如果 /home/david/blog.git 实际上是一个非裸仓库,那么它将有一个 .git 子目录。如果是这种情况,您可以将程序指向 /home/david/blog.git/.git ,但我不禁感到,点安全它在一个真正的裸仓库。它是什么程序以及初始化其数据存储的指示是什么?
`


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, i.e. 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存储库”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆