There is a Git repository proj.git
, cloned to proj1
and proj2
. proj1
has no worktree, proj2
has a worktree.
The goal: update a.txt
in proj1
, get the change updated to worktree in proj2
.
The problem: git pull
fails on proj2
with an error message:
fatal: Not a git repository (or any of the parent directories): .git
Reproducing the problem:
Create proj.git
and proj1
:
$ git init --bare proj.git
$ git clone proj.git proj1
$ cd proj1
- edit a.txt: v1
$ git add .
$ git commit -m "v1"
$ git push -u origin master
Create proj2
with worktree:
$ cd ..
$ git clone -n proj.git proj2
$ mkdir proj2_worktree
$ cd proj2
- edit .git/config:
[core]
...
worktree = /path/to/workarea/proj2_worktree
$ git checkout
proj2_worktree
contains a.txt
, works as expected.
Check the status of origin in proj2
:
$ git remote show origin
* remote origin
Fetch URL: /path/to/workarea/proj.git
Push URL: /path/to/workarea/proj.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
Try to pull-in changes in proj2
(that does have .git
):
$ git pull
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
$ git init
Reinitialized existing Git repository in /path/to/workarea/proj2/.git/
$ git pull
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
What am I doing wrong? My Git versions are 1.7.10.4 on Debian / 2.1.1 on Cygwin.
EDIT:
An additional finding: In proj2
, the usual fetch
/merge
will work as a workaround to the problem:
$ git fetch
$ git merge origin master
BUT: still, why does pull
not work?