这是我的问题:
- 我创建了一个名为“项目”的新 git 存储库。它里面有一些文件。
我克隆该存储库:
git clone --bare project project.git
吉特告诉我:
Cloning into bare repository 'project.git'... done. error: refs/head/master does not point to a valid object!
我确实得到了一个名为 project.git 的目录,但如果我继续:
git init --bare --shared project.git
git clone project.git project2
吉特告诉我:
Cloning into 'project2'... warning: You appear to have cloned an empty repository. done.
所以我现在在克隆的存储库中没有文件:'project2'。我第一次遇到这个问题时,我试图像往常一样通过裸克隆共享一个现有的存储库。现在它发生在我创建的所有新存储库中。但是,如果我创建存储库,然后将其复制到我的另一台机器,然后在其上进行裸克隆,我没有问题。
有任何想法吗?
谢谢
更新:
问题仅发生在网络驱动器上,而不是本地磁盘上。C是我的本地盘,H是我的网盘:
本地 = 没有问题:
$ 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
网盘=问题:
$ 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