I am attempting to clone a git repository on a Windows network drive, but the process fails. It first throws a internal error: refs/remotes/origin/master is not a valid packed reference
, and then repeatedly relates that it failed to unlink an index file.
x:\code\source> git clone x:\code\repos\project.git
Cloning into 'project'...
done.
error: internal error: refs/remotes/origin/master is not a valid packed reference!
fatal: update_ref failed for ref 'HEAD': cannot update the ref 'HEAD':
Trying to write ref refs/heads/master with nonexistent object d34950c3faee46d8a7f3b8e7950b04fcc5da9d1c
Unlink of file 'project/.git/objects/pack/pack-....idx' failed. Should I try again? (y/n)
I am able to clone without issue to a local drive from a bare repo on the network drive, but am unable to clone to a network drive.
When cloning to a mapped network drive using a standard Windows command prompt, you need to preface the from path with file://
.
E.g.,
git clone file://x:\code\repos\project.git
or, if there are spaces,
git clone "file://x:\my code\repos\project.git"
You cannot, however, do the same when specifying the target.
** DOESN'T WORK **
git clone file://x:\code\repos\project.git file://y:\code\source\project
Instead,
cd y:\code\source
git clone file://x:\code\repos\project.git project
For future readers who are trying to use GitExtensions and getting this error: David C's answer works for our purposes as well, and you can type in file://
before the 'Repo to clone' location name.
This error arises when the Repo to clone and destination directory are both on a local network drive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With