DEV Community 👩‍💻👨‍💻

Rafael Gimenes Leite
Rafael Gimenes Leite

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)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git