DEV Community

rafaone
rafaone

Posted on

1 1

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)

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay