From the Tor manual site:
Add the following lines to your torrc:
HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:8080
You're going to want to change the HiddenServiceDir line, so it points to an actual directory that is readable/writeable by the user that will be running Tor. The above line should work if you're using the OS X Tor package. On Unix, try "/home/username/hidden_service/" and fill in your own username in place of "username". On Windows you might pick:
HiddenServiceDir C:\Users\username\Documents\tor\hidden_service
HiddenServicePort 80 127.0.0.1:8080
Now save the torrc and restart your tor.
Accessing the hidden services is explained here
In short it says README once, than README twice:
FreeCap is an alternative. When using FreeCap set proxy protocol to SOCKS 5 and under settings set DNS name resolving to remote. This will allow you to use almost any program with Tor without leaking DNS lookups and allow those same programs to access hidden services.
Set that up correctly, you should be able to enter into a browser the tor hostname of your git server found here:
The other file Tor will create is called "hostname". This contains a short summary of your public key -- it will look something like duskgytldkxiuqc6.onion. This is the public name for your service, and you can tell it to people, publish it on websites, put it on business cards, etc.