DEV Community

rafaone
rafaone

Posted on

Commit using ssh Tunel

Scenario is

Machine 1: VPS Cloud : Folder with repositories /media/repos

Machine 2: host with VSCODE remote ssh on raspberry

Machine 3: Raspberry running the project.

The Machine 3 do not have internet access or vpn limitation and needs to push an committed code to VPS cloud but cant reach the Machine 1.

Ideia is use the Machine 2 as bridge between he machines, but in reall its a ssh local tunneling.

On machine 2:

ssh -L 0.0.0.0:8888:*:22 -C -N -l userName vpsURL.com
Enter fullscreen mode Exit fullscreen mode

basically we are open a port 8888 and redirect to VPS on 22 port.

On machine 3 raspberry

hg push ssh://user@IP_MACHINE_2:8888//media/repos/projectPath

Enter fullscreen mode Exit fullscreen mode

This command is pushing originally for machine 2, but the ssh will forward to VPS cloud.

Works with git also.

Top comments (0)