# Cannot clone a linked working directory.

2 messages from 2015-06-24 to 2015-06-24. Participants: Bjørnar Snoksrud, Duy Nguyen.
Thread: https://gitlist.dev/t/39708

## Bjørnar Snoksrud, 2015-06-24 10:38

Subject: Cannot clone a linked working directory.
Message-ID: <CA+cck7FB6QPz1Pec11TPXxxAhwKR78K9swgsQjMrZPhKJzi_iw@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bcck7FB6QPz1Pec11TPXxxAhwKR78K9swgsQjMrZPhKJzi_iw%40mail.gmail.com

```
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, 2015-06-24 11:16

Subject: Re: Cannot clone a linked working directory.
Message-ID: <CACsJy8BDrkrxO6f8SgqRjmLgSCwALqhO5hXEOo51v25=6NpwrA@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8BDrkrxO6f8SgqRjmLgSCwALqhO5hXEOo51v25%3D6NpwrA%40mail.gmail.com
In-Reply-To: <CA+cck7FB6QPz1Pec11TPXxxAhwKR78K9swgsQjMrZPhKJzi_iw@mail.gmail.com>

```
On Wed, Jun 24, 2015 at 5:38 PM, Bjørnar Snoksrud <snoksrud@gmail.com> wrote:
> 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

```
