tags:

views:

27

answers:

2

I have a repo in dir ~/myRepo/. Because I want to use this repo across multiple machines, I want to have the .git folder in my dir ~/Dropbox/.

I know, that there was some ability to create a file in ~/myRepo, which contains a path to the git-folder ~/Dropbox/myRepo.git, but I forgot which and cannot find the information in the man-pages.

Please don't tell me to simply ln -s the folder, I tried this and considered it impracticable.

A: 

There's the environment variable GIT_DIR that can point at a .git directory, but you would need to have that set correctly when working in the specific folder.

Novelocrat
AFAIK, there is a file you can add, but I really forgot it's name.
FUZxxl
+3  A: 

Maybe you are looking for the “gitfile” functionality. It is briefly mentioned in gitrepository-layout(5):

… (… It is also possible to have a working tree where .git is a plain ASCII file containing gitdir: <path>, i.e. the path to the real git repository).

You do not say why symlinks will not work for you but the only advantage this has is that it will work in environments that do not support symlinks. It is effectively an application-level symlink (much like Git’s symbolic refs).

Make ~/myRepo/.git a normal file with the following text:

gitdir: ../Dropbox/myRepo.git

Note: This setup will use a repository that is probably marked as bare (~/Dropbox/myRepo.git) in a non-bare fashion for operations done under ~/myRepo. You may run into problems.

Chris Johnsen
The reason is, that I want to have this repository available under a Windows machine too, and as I'm not really familiar with Windows shell, I don't know how to set up a symlink there.
FUZxxl