Work tree already exists exception when cloning a GIT repo in a hook hook

I am trying to clone my local git repository inside a pre-click script (client click). I get an exception:

fatal: working tree '...' already exists.

I don't understand the exception, as I obviously cloned the repo into another directory.

Any ideas?


I tried:

unset GIT_DIR
cd ..
git clone ./TestTest/ /tmp/PrePushTestClone

It doesn’t work exactly the same: (

+4
source share
2 answers

I had the same problem, except that I was dealing with a pre-commithook. When trying cloneanother repo inside the current repository, an error occurred with the text:

fatal: working tree '.' already exists.

, clone:

unset GIT_WORK_TREE

: https://github.com/bower/bower/issues/1033

+5

, , .

$GIT_DIR , git clone.

, :

  • unset GIT_DIR script
  • git clone
+1

Source: https://habr.com/ru/post/1619503/


All Articles