I have my Git repo on my machine, which has no public IP of its own, at home; I want to clone this repo at my web server. Is it correct that a reverse tunnel will allow me to pu
In principle, you can do something like
ssh -R 2222:localhost:22 username@webserver.com
and then use on your webserver
git clone ssh://user@localhost:2222/path/to/repo.git/
This will encrypt your data twice, though.
Alternatively, you can use any of the other protocols which git supports, and forward the right ports for these.
You can also put a section like this into ~/.ssh/config:
Host my-server
HostName localhost
ForwardX11 no
Port 2222
Then you can use this clone command:
git clone git@my-server:mytools/projectName.git
. (This allows you to store the server's key not as belonging to localhost
, and makes the URL in your git config clearer.)
For your server (both the tunnel server and the final host) you usually want to authenticate per public-key authorization, for this you should put the private key (e.g. id_rsa) in your ~/.ssh directory. (And all files there, specifically the private key, should be readable only for your user, and the directory writable only for your user.)
All this is not specific for the tunnel, but generic SSH stuff.