I have a git repository on a usb stick and want to copy it to my hard drive. I have tried copying it over with rsync -rXP
, cp
and the gui in ubuntu but on the copied version all commits seem to have vanished. When I type git log
or git reflog
, I get
fatal: your current branch 'master' does not have any commits yet
The file .git/logs/HEAD shows all commits but git can't see them.
How do I move the repository over without losing any data?
EDIT1+3+5: commands used:
rsync -rXP usb_folder/ hdd_folder
cp -rp usb_folder hdd_folder
(hdd_folder is located in /home)rsync -a usb_folder/ hdd_folder
- change ownership with
sudo chown
andsudo chmod -v -R a+rwx usb_folder
+ copying. File permissions didn't actually change though (turns out this doesn't work on fat32 filesystems, should've known -.-')
When I copy the repository to a new folder on the same usb stick the commits are still there
EDIT2:
I don't want to use git clone
for the reasons mentioned here and because I have a bunch of untracked files I need for testing
EDIT4:
Repository may have been created with git for Windows. Problem with windows line-endings or version? The commits are present on the usb stick though
EDIT5:
It seems to be a problem with the filesystem (usb stick is fat32) and/or git for windows (repository was probably created with git for windows). I can copy the repository to a windows 10 pc and git log
within the git bash will show all commits correctly. If I use the ubuntu subsystem to check, all commits are gone (though some files are staged for some reason)