Syncing with github
Asked Answered
J

5

16

This is for the nth time that I'm trying to connect to my github account and its becoming increasingly frustrating at my failure to do this.

I followed this tutorial step by step Github setup on windows but I failed at step 5, i.e. Test everything out.

ssh [email protected]

gives me this

ssh: github.com: no address associated with name

Any ideas what is wrong? Any help would be greatly appreciated.

I'm using the default git installation which comes with railsinstaller on Windows XP (behind a proxy)

Junitajunius answered 21/3, 2011 at 12:41 Comment(0)
M
20

You need to at least set an HTTP_PROXY variable environment.

set HTTPS_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
set HTTP_PROXY=http://<login_internet>:<password_internet>@aproxy:aport

Or, for bash session:

 export http_proxy=http://<login_internet>:<password_internet>@aproxy:aport
 export https_proxy=http://<login_internet>:<password_internet>@aproxy:aport

Make sure %HOME% (or $HOME) is set to a directory where you did store your .ssh config

Then, for git commands:

git config --system http.sslcainfo \\bin\\curl-ca-bundle.crt
git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport
git config --global user.name <short_username>
git config --global user.email <email>
git config --global github.user <github_username>
git config --global github.token <github_token>

Note: for bash session:

git config --system http.sslcainfo /bin/curl-ca-bundle.crt

To avoid GitHub asking for your password, create a _netrc file in your HOME (or a .netrc for bash session)

machine github.com
login <login_github>
password <password_github>

Update 2012

Note that since git1.7.10 (2012), you can use a credential caching mechanism in order to avoid having to store in plain text your login/password (in a %HOME%/_netrc file).

Muss answered 21/3, 2011 at 13:17 Comment(6)
If your having an error about \\bin \\ curl-ca-bundle.crt, you can use: git config --global http.sslverify "false"Neusatz
@GonzaloJarjury That would not be a practice I would recommend. Always try to verify your certificates. Try first, even on Windows with recent version of Git: git config --system http.sslcainfo /ssl/certs/ca-bundle.crtMuss
Is <login_internet> the WiFi name?Maffick
@McFloofenbork 8 years later, I believe the "login_internet" represents your login account you would use to authenticate to the proxy.Muss
what are the <login_internet> and <login_password>?Aarika
@Aarika Same: an enterprise proxy needs the credentials of your current Windows or Mac session: your login and password for your current OS session.Muss
F
1

For those who don't have a proxy enabled and the problem persists, I found the solution! It's a problem with Yosemite. Apple replaced the mDNSResponder by the discoveryd. It's a service and you can unload and load it back:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

This post explains every detail:

http://arstechnica.com/apple/2015/01/why-dns-in-os-x-10-10-is-broken-and-what-you-can-do-to-fix-it/

It worked for me!

Favourable answered 30/1, 2015 at 4:59 Comment(0)
C
1

in edge cases it might not be the proxy that is causing the issues more like the DNS settings.

Test if DNS resolve works or not

nslookup archive.ubuntu.com 

If correctly setup, you will see IP address, if broken you will see error message.

How to check DNS config (Ubuntu) cat /etc/resolv.conf

# This file was automatically generated by WSL. T># [network]
# generateResolvConf = false
nameserver 8.8.8.8 
nameserver 8.8.4.4

You can use these two Google DNS Servers for testing.

Try nslookup command again. If it works now, It´s been an DNS issue all along.

Test github connection

  1. SSH
ssh -T [email protected]

Output if successfull will look something like this

This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi <YourUsername>! You've successfully authenticated, but GitHub does not provide shell access.
  1. HTTPS Try simply do clone e.g. git clone https://github.com/octocat/Spoon-Knife

If issues are fixed, it will prompt for username and password.

Chickenlivered answered 9/11, 2023 at 22:7 Comment(1)
thanks! I've got suddenly "fatal: unable to access 'github.com...': Could not resolve host: github.com" by given "git pull". Updating /etc/resolv.conf like here helped.Coarsen
C
0

If you are behind a proxy, are you also behind a firewall? Please try to run ssh -v [email protected] to see what's going on behind the scenes. For my setup, my ~/.ssh/config looks like this:

Host github.com
ProxyCommand /c/windows/connect.exe -H name_of_proxy:8080 %h %p
User git
Port 443
Hostname ssh.github.com
TCPKeepAlive yes
IdentitiesOnly yes

The ProxyCommand is described here.

Comitia answered 21/3, 2011 at 13:6 Comment(1)
Yes, I'm behind a firewall. However, the proxy i'm using is a script and not a static address. How can I take that into account in the config file?Junitajunius
C
0

It seems like you might not have configured your SSH config properly. The reason github.com is unresolvable is because you are probably pointed to a DNS server that doesn't resolve queries outside your domain.

I wrote a whole blog post about this so take a look here: http://returnbooleantrue.blogspot.com/2009/06/using-github-through-draconian-proxies.html

Hope this helps.

Communist answered 29/10, 2011 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.