Question

If I want to clone a Git repository via SSH, I get:

ssh: Could not resolve hostname bitbucket.org: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

I need to use a proxy to connect to the internet. (proxy:8080)

In Git I can easily set the HTTP and HTTPS proxy via:

git config --global http.proxy http://proxy:8080/
git config --global https.proxy http://proxy:8080/

How can this be achieved for SSH?

Was it helpful?

Solution

SSH doesn't work with an HTTP/HTTPS proxy. If your proxy supports SOCKS, you may be able to use git via SOCKS using a wrapper like tsocks or socksify or a redirection tool like redsocks. Those are options for Linux; on Windows maybe something like Widecap will help. Here's a more comprehensive overview of tools that may be suitable: https://en.wikipedia.org/wiki/Comparison_of_proxifiers

Alternatively, Git supports HTTP, too, and so does BitBucket, as far as I know. Hence, it might be worth trying the URL with https:// instead. Example: https://youruser@bitbucket.org/youruser/yourrepository.git

OTHER TIPS

I faced similar issue and landed up here. In my case one of my local gitlab project was throwing below error for push/pull. Other gitlab projects under same group were working fine.

ssh: Could not resolve hostname gitlab.com: nodename nor servname provided, or not known.

Fix :

In file <PROJECT_FOLDER>/.git/config url was like url = ssh://git@gitlab.com

Removing ssh:// from url worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top