GIT refs / heads / master不指向有效的对象 [英] GIT refs/heads/master does not point to a valid object
问题描述
以下是我的问题:
- 我创建了一个名为'project'的新git存储库。它包含一些文件。 --bare project project.git
-
Git告诉我:
克隆到裸仓库'project.git'...
完成。错误:refs / head / master没有指向一个有效的对象! -
我得到一个名为project.git的目录,但如果我继续:
-
git init --bare --shared project.git
-
git clone project.git project2
-
-
Git告诉我:
克隆到'project2'中...
警告:您似乎克隆了一个空的存储库。
完成。
因此,我现在在克隆存储库中没有文件:'project2'。我第一次遇到这个问题时,我正在尝试通过裸露克隆来共享现有的存储库,就像我通常那样。现在它发生在我创建的所有新存储库中。但是,如果我创建了reposotory,然后将其复制到其他机器上,然后在其上创建裸机,我没有任何问题。
有什么想法?
谢谢
更新:
此问题仅出现在网络驱动器而非本地磁盘上。 C是我的本地磁盘,H是我的网络磁盘:
Local =没有问题:
$ cd c:/ temp
$ mkdir foo; cd foo
$ git init
在c:/temp/foo/.git/
$ echo'a'>中初始化的空Git仓库一个; git add a; git commit -m'a'
警告:LF将被CRLF替换为a。
该文件将在工作目录中具有其原始行结尾。
[master(root-commit)f695c9d] a
警告:LF将被a中的CRLF替换。
该文件将在工作目录中具有其原始行结尾。
1文件已更改,1个插入(+)
创建模式100644 a
$ cd ..
$ git clone --bare foo foo.git
克隆入裸仓库'foo.git'...
完成。
$ ls foo.git /
HEAD配置描述钩子信息对象packed-refs refs
网盘=问题:
$ cd h:
$ mkdir foo; cd foo
$ git init
在h:/foo/.git/
$ echo'a'>中初始化的空Git仓库一个; git add a; git commit -m'a'
警告:LF将被CRLF替换为a。
该文件将在工作目录中具有其原始行结尾。
[master(root-commit)5348b42] a
警告:LF将被a中的CRLF替换。
该文件将在工作目录中具有其原始行结尾。
1文件已更改,1个插入(+)
创建模式100644 a
$ cd ..
$ git clone --bare foo foo.git
克隆入裸仓库'foo.git'...
完成。
错误:refs / heads / master没有指向一个有效的对象!
$ ls foo.git /
HEAD配置描述钩子信息对象packed-refs refs
答案非常简单,我遇到了同样的问题。 GIT不允许谷歌驱动器更新\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'推并在另一台机器B,你试图克隆它... ...手动改变你的机器上的参考代码B,它的工作原理是完美的,但无论如何,这是毫无意义的哟每次单独提交后手动更新主文件:)
Here's my problem:
- I create a new git repository named 'project'. It has some files in it.
I clone that repository with:
git clone --bare project project.git
Git tells me:
Cloning into bare repository 'project.git'... done. error: refs/head/master does not point to a valid object!
I do get a directory named project.git but if I go on with:
git init --bare --shared project.git
git clone project.git project2
Git tells me:
Cloning into 'project2'... warning: You appear to have cloned an empty repository. done.
So I now have no files in the cloned repository: 'project2'. I first encountered this problem with an existing repository that I was trying to share by a bare clone as I usually do. Now it happens with all new repositories that I create. However, If I create the reposotory then copy it to my other machine and then make the bare clone on it, I have no problems.
Any ideas?
Thanks
Update:
The probelm is only occurin on a network drive not the local disk. C is my local disk and H is my network disk:
Local = no problems:
$ cd c:/temp
$ mkdir foo; cd foo
$ git init
Initialized empty Git repository in c:/temp/foo/.git/
$ echo 'a' > a; git add a; git commit -m 'a'
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
[master (root-commit) f695c9d] a
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
1 file changed, 1 insertion(+)
create mode 100644 a
$ cd ..
$ git clone --bare foo foo.git
Cloning into bare repository 'foo.git'...
done.
$ ls foo.git/
HEAD config description hooks info objects packed-refs refs
Network disk = problems:
$ cd h:
$ mkdir foo; cd foo
$ git init
Initialized empty Git repository in h:/foo/.git/
$ echo 'a' > a; git add a; git commit -m 'a'
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
[master (root-commit) 5348b42] a
warning: LF will be replaced by CRLF in a.
The file will have its original line endings in your working directory.
1 file changed, 1 insertion(+)
create mode 100644 a
$ cd ..
$ git clone --bare foo foo.git
Cloning into bare repository 'foo.git'...
done.
error: refs/heads/master does not point to a valid object!
$ ls foo.git/
HEAD config description hooks info objects packed-refs refs
the answer is really easy, I had the same problem. GIT does not allow google drive to update \refs\heads\master , so you end up with two different references codes on the machine A which you have made a commit & push and on another machine B which you are trying to clone it to... change manually reference code on your machine B and it works perfectly, but, anyway it is pointless yo update master file every time manually after every single commit :)
这篇关于GIT refs / heads / master不指向有效的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!