Git(Windows) - 从单独的git-dir存储库中克隆失败

时间:2011-08-16 19:07:56

标签: windows git clone

我几天都在努力寻找答案:(

在尝试克隆从使用--separate-git-dir初始化的存储库时,是否可以确认我是否在下面的示例中获得了'Git clone'的语法?

如果是这样,这是否适用于Linux系统?

使用Windows上的Git(从GitExtensions224SetupComplete.msi安装git版本1.7.6.msysgit.0)我得到一个错误,如下所示,看起来好像'Git clone'期望repo具有'正常'积分.git dir

as -separate-git-dir是msysgit中的一个相当新的功能,也许克隆命令还不支持它?

F:\>mkdir repo2
F:\>mkdir repo2git
F:\>cd repo2
F:\repo2>call git init --separate-git-dir="..\repo2git\.git"
Initialized empty Git repository in F:/repo2git/.git/
F:\repo2>echo abc >file1.txt
F:\repo2>call git add . -A
F:\repo2>call git commit -m "first"
[master (root-commit) c7e4766] first
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file1.txt
F:\repo2>cd ..
F:\>call git clone repo2 clone2
Cloning into clone2...
fatal: failed to open 'F:/repo2/objects': No such file or directory

非常感谢您对此有任何见解。

1 个答案:

答案 0 :(得分:0)

在完成你在这里做的事后,你的初始'git init'是不对的。您克隆时遇到问题,因为您的存储库不适合开始使用。这是我做的:

Travis@CASTLE ~/travtemp
$ git init travis
Initialized empty Git repository in c:/Users/Travis/travtemp/travis/.git/

Travis@CASTLE ~/travtemp
$ ls
repo2  repo2git  travis

Travis@CASTLE ~/travtemp
$ cd travis/

Travis@CASTLE ~/travtemp/travis (master)
$ touch t1

Travis@CASTLE ~/travtemp/travis (master)
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       t1
nothing added to commit but untracked files present (use "git add" to track)

Travis@CASTLE ~/travtemp/travis (master)
$ git add .

Travis@CASTLE ~/travtemp/travis (master)
$ git commit -m "first"
[master (root-commit) d93a0d0] first
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 t1

Travis@CASTLE ~/travtemp/travis (master)
$ git status
# On branch master
nothing to commit (working directory clean)

Travis@CASTLE ~/travtemp/travis (master)
$ cd ..

Travis@CASTLE ~/travtemp
$ git clone travis new
Cloning into new...
done.

Travis@CASTLE ~/travtemp
$ ls
new  repo2  repo2git  travis

线程GIT clone repo across local file system

还有其他信息