threads / discuss / 39708

Cannot clone a linked working directory.

Subject: Cannot clone a linked working directory.

## tl;dr

2 messages between Jun 24, 2015 and Jun 24, 2015.

replies: 1people: 2as markdown or json

Bjørnar Snoksrud· Jun 24, 2015, 10:38 UTC · lore

Summary: When creating a linked working directory with `git checkout --to`, you cannot clone from the local path. This works when cloning the main repository directory.

I couldn't find anything the the documentation for `git checkout` that indicates that this shouldn't work.

Repro: Creating a repo `foo`, checkout --to'ing it to ../bar, then try to clone both resulting repositories -

$ git --version git version 2.4.4.600.g6397abd $ mkdir foo $ cd foo $ git init Initialized empty Git repository in /bar/foo/.git/ $ git commit -m init --allow-empty [master (root-commit) c6da399] init $ git branch bar $ git checkout bar --to ../bar Enter ../bar (identifier bar) Switched to branch 'bar' $ cd ../bar $ cd bar $ git status -sb ## bar $ cd .. $ git clone bar baz Cloning into 'baz'... fatal: '/path/bar' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. $ git clone foo baz Cloning into 'baz'... done.

-- 
bjornar@snoksrud.no
Duy Nguyen· Jun 24, 2015, 11:16 UTC · re: Bjørnar Snoksrud · lore

Re: Cannot clone a linked working directory.

On Wed, Jun 24, 2015 at 5:38 PM, Bjørnar Snoksrud <snoksrud@gmail.com> wrote:
Show 7 quoted lines
> Summary:
> When creating a linked working directory with `git checkout --to`, you
> cannot clone from the local path. This works when cloning the main
> repository directory.
>
> I couldn't find anything the the documentation for `git checkout` that
> indicates that this shouldn't work.

I didn't think of this use case. If something works on the main worktree then it should also work on linked checkouts. I think I see the problem and will try to fix it in probably a few days (the "git add -N" problem takes higher priority).

-- 
Duy

← back to recent threads