logo
podcast Podcast
get help Get Unstuck

Connecting to a git repo through a SOCKS proxy

Sometimes it has to be done.

Joel Clermont
Joel Clermont
2024-11-01

Yesterday, I shared on tip on how we connect to private git servers using SSH. But what do you do if the private server only supports HTTPS?

It can still be done, but it involves an extra step.

First, you need to set up a SOCKS proxy. This can be done with an SSH tunnel, just like we did with the SSH proxy:

ssh -ND 1080 our-proxy.server.com

Next, you need add some git configuration to use the SOCKS proxy for this host:

# ~/.gitconfig
[http "https://internal-git-server.client.com"]
        proxy = socks5://localhost:1080

Now, when you interact with this repo using git, it will automatically use the SOCKS proxy configuration. No extra command line options needed.

Ideally, you'd be able to use SSH for everything, but sometimes you have to work with what you're given.

Here to help,

Joel

P.S. Do you work alone and want someone to pair with on your Laravel app?

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.