Use 'git clone --no-local' when creating a fork
Related to https://gitlab.com/gitlab-com/infrastructure/issues/2725
In certain environments (including gitlab.com production), forking a repository runs the equivalent of git clone --local --no-hardlinks
. During this type of clone Git tries to copy every file in the objects directory of the source repository. If some of those files are not readable (e.g. permissions 0000) then the clone will fail.
It seems that libgit2 creates temporary files with mode 0000 in the objects directory of bare repositories. When you combine these two things you get repositories that cannot be forked.
This MR changes the behavior of the fork commands to use git clone --no-local
which avoids the 'blindly copy all files' behavior of Git described above. This lets us avoid this bug.