Git (Windows) - 从单独的 git-dir 存储库克隆失败
几天来我一直在努力寻找这个问题的答案:(
当尝试从使用 --separate- 初始化的存储库进行克隆时,任何人都可以确认我是否在下面的示例中获得了正确的“Git 克隆”语法git-dir 吗?
如果是,这在 Linux 系统上有效吗?
在 Windows 上使用 Git(从 GitExtensions224SetupComplete.msi 安装的 git 版本 1.7.6.msysgit.0)时,我收到错误,如下所示,看起来“Git clone”期望存储库有一个“正常”的完整 .git dir
也许克隆命令还不支持它?
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
因为 --separate-git-dir 是 msysgit 中的一个相当新的功能, 对此有任何见解。
I've been struggling to find an answer to this for days :(
Can anyone confirm whether I've got the syntax right in the example below for 'Git clone' when attempting to clone FROM a repository that was initialized using --separate-git-dir ?
If so, does this work on Linux systems ?
With Git on windows (git version 1.7.6.msysgit.0 installed from GitExtensions224SetupComplete.msi) I get an error, as below, that looks as though 'Git clone' is expecting the repo to have a 'normal' integral .git dir
As --separate-git-dir is a fairly recent feature in msysgit perhaps the clone command doesnt yet support it ?
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
Many thanks in advance for any insight into this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
完成您在这里所做的操作后,您最初的“git init”不正确。您在克隆时遇到问题,因为您的存储库一开始就不正确。这就是我所做的:
还有关于线程 GIT clone repo across local file 的附加信息系统
After stepping through what you did here, your initial 'git init' is not right. You are having trouble cloning because your repository was not right to begin with. Here's what I did:
There also additional information on the thread GIT clone repo across local file system