tags:

views:

241

answers:

4

I don't think this is possible without a bit of hacking but just throwing it out there.

In Git is it possible to relocate the bulk of the .git folder (/objects i assume) to another location. I am having a problem without my current hard drive filling up with git and i want to be able to move it to a separate hard drive to free up space.

A: 

Usually the .git directory isn't that big. When is the last time you did a garbage collection?

git gc

This cleans up unreferenced objects in the git store.

1800 INFORMATION
+3  A: 

Duplicate of Can I store the .git folder outside the files I want tracked?

Henrik Paul
+5  A: 

There are three possibilities I can think of:

  1. The GIT_DIR environment variable tells Git where to look for the repository. The default is .git, obviously, but you can also set it to /some/where/else, if you want.
  2. The GIT_OBJECT_DIR environment variable does the same, but just for the .git/objects subdirectory, not the whole repository.
  3. You can use the file .git/objects/info/alternates or the environment variable $GIT_ALTERNATE_OBJECT_DIRECTORIES to "borrow" objects from another repository.

See the git-repositorylayout(5) manual page for details.

Jörg W Mittag
A: 

Git has a command line option called --git-dir. Whenever you run git, use the --git-dir option.

 git --git-dir=a_different_git_directory status

Perhaps you could put that in a batch file or something to make your life easier.

Michael