1

I am working on a machine that does not have direct access to the internet, but other nodes on the domain do. This means that I can ssh to another machine to sync my git repo, but I cannot do it from the machine itself.

> git clone https://git.example.com/git/myproj.git ~
fatal: unable to access 'https://git.example.com/git/myproj.git'

> ssh machine2
> git clone https://git.example.com/git/myproj.git ~
successfully cloned into '~/myproj'

I would like to be able to use machine2 as a proxy to connect to the git server. Unfortunately, machine2 is not configured as an http proxy, and the git server is not configured to use the git:// or ssh:// protocols. Is there a way that I can use machine2 as a proxy to establish an https connection with git.example.com? Note that I do not have sudo privileges on machine2.

Update:

A complicating factor appears to be the fact that I am using a private key to authenticate with the HTTPS server. In my ~/.gitconfig I have the following lines

[http]
    sslkey = /home/nispio/.ssl/example.key.pem
    sslkey = /home/nispio/.ssl/example.crt.pem
    sslcainfo = /home/nispio/.ssl/example-ca.crt.pem

All of this is configured properly, as evidenced by the fact that I can successfully clone the repo from machine2 using these credentials. Attempting to use a simple socks server as proposed by @IporSircer however, does not seem to forward my credentials properly.

1 Answer 1

0

Use ssh socks server:

ssh -D 1080 machine2

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
git clone https://git.example.com/git/myproj.git ~
3
  • fatal: unable to access ... : Proxy CONNECT aborted Is there a good way to verify the socks server independent of git?
    – nispio
    Commented Sep 26, 2016 at 23:08
  • After playing with a toy example, I realized that the problem only exists when using key authentication over SSL. I will update the question.
    – nispio
    Commented Sep 26, 2016 at 23:34
  • Proxy CONNECT aborted This way is not working
    – Hamidreza
    Commented Sep 17, 2018 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .