I am not asking how to move a git repository. I want to move the metadata contained within .git to somewhere else on a single machine, without affecting the rest of the world.
The goal is to have
~/gitmetadata/myproject/.git
~/gitmetadata/myproject/.gitignore
~/somecode/myproject/ # No .git here anymore
The purpose of this exercise is to place .git onto persistent storage (ssd) while the working directory holding source / object code etc is on a ram disk. I don't especially want to put the .git on the ramdisk as well, since I'd rather not have to start each reboot by cloning a remote repo.
Ideally I'm looking for a configuration option that I can write into a per-machine configuration file that says "actually, the files are over there".
I can work around this by either having a local repo that I pull from, provided I learn how to configure a git repo to do transparent forwarding, or by hacking up the filesystem unionfs style which will be slow.
Can git put the .git metadata somewhere else?
edit: One of the answers included the phrase "git config core.worktree". Typing this into google found a duplicates which my search did not, 2013, 2009