Reactormonk
Reactormonk

Reputation: 21710

Can I place .git somewhere else?

I'd like to use git for backups, but using more than double the space for .git is a bit too much. Is there a nice parameter that places the data somewhere else or do I have to mount my backup HD to .git?

Upvotes: 1

Views: 192

Answers (1)

VonC
VonC

Reputation: 1326366

You can use the GIT_DIR environment variable in order to put your .git in another place than your current working tree.

From Git man page:

--git-dir=<path>

Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.

Note that you will find valid alternatives for backing up a Git repo in this SO question (not including the bup system mentioned by Greg Hewgill in the comments, python-based, which stores its data in a git-formatted repository).

Upvotes: 4

Related Questions