3

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.

tibbs
  • 31
  • 1
  • 3

1 Answers1

0

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:

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

There also additional information on the thread GIT clone repo across local file system

Community
  • 1
  • 1
Travis Nelson
  • 2,590
  • 5
  • 28
  • 34
  • 1
    Thanks for answering, but I'm specifically trying to clone a repo inited with --separate-git-dir (as I'm experimenting with using Git for backing up web server directories on a daily basis and don't really want the .git repositories in the website root directories). Git gui shows my example repo as being valid & containing the first commit etc. although it fails trying to clone it as well :( – tibbs Aug 16 '11 at 21:11