[SOLVED] Bare Git repos and global variables

Hey, I am following the OpenSSH and Git video from @wendell and I have a question about how the variables are managed. Wendell said to set the GIT_DIRand GIT_WORK_TREE variables, but from my own testing they are global. He also said to set them in the .bashrc file, but that would make things even worse. How can I set this up so that I can still use other git repos while retaining the security best practice of keeping the .git folder outside of the public_html root?

In that case I suggest an alias like wgit similar to

alias wgit="/usr/bin/git --git-dir= $HOME/public_html-git/ --work-tree=/HOME/public_html"

And not bother with the globals. Usually tho I recommend process isolation so you automatically get one account per site/repo automatically tho…

1 Like

Thanks! Looks like it worked. I’m just running a pi B1 and have some apache webservers in /var/www/* and I didn’t want to mess with multiple users, but I guess I will when I actually get a server.