title: Mac OS command line authenticating with GitHub
body: <p>While trying to connect to GitHub to validate my podspec, I keep getting the following error:</p>
  
  <blockquote>
    <p>fatal: unable to access '<a href="https://github.com/myAccount/myRepo.git/" rel="nofollow noreferrer">https://github.com/myAccount/myRepo.git/</a>': Failed to connect to 159.82.13.140 port 80: Operation timed out</p>
  </blockquote>
  
  <p>It seems to be my connection to GitHub specifically, because cloning from the command line throws the same error:</p>
  
  <pre><code>git clone https://github.com/myAccount/myRepo.git ~/Desktop/testClone
  Cloning into '/Users/myAccount/Desktop/project'...
  fatal: unable to access 'https://github.com/myAccount/myRepo.git/': Failed to connect to 159.82.13.140 port 80: Operation timed out
  </code></pre>
  
  <p>Normally I manage VCS through Xcode, which lets me input my auth credentials, but I realized I need to setup ssh keys.</p>
  
  <p>After setting that up, it looks like it should work:</p>
  
  <pre><code>ssh -T git@github.com
  Hi myAccount! You've successfully authenticated, but GitHub does not provide shell access.
  </code></pre>
  
  <p>However the error persists both when trying to run <code>pod spec lint</code> and <code>git clone</code>. I've restarted my terminal shells, and as a Mac user (Mojave) I learned that I need to create a file at <code>~/.ssh/config</code> with the below text:</p>
  
  <pre><code>Host github.com
     AddKeysToAgent yes
     UseKeychain yes
     IdentityFile ~/.ssh/id_rsa
  </code></pre>
  
  <p><strong>Any idea on next steps?</strong></p>
  
  <p>I'm not seeing the key in my KeyChain Access. Shouldn't it be there? If so, how do I import it?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Tried using <a href="https://medium.com/@ginnyfahs/github-error-authentication-failed-from-command-line-3a545bfd0ca8" rel="nofollow noreferrer">this article</a> to connect with a generated token; but still get the same error. Also updated my config with these fields, which may not be getting pointed to or something...</p>
  
  <pre><code>Host github.com   
  User git
  Hostname github.com
  PreferredAuthentications ~/.ssh/id_rsa.pub
  Port 80
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa
  </code></pre>
  
  <p>Up until I attempted to use the generated token, I was able to successfully ssh in with <code>ssh -T git@github.com</code> but now I get the following error:</p>
  
  <pre><code>ssh_exchange_identification: Connection closed by remote host 
  </code></pre>
  
  <p>Somehow I made it worse? Tried reseting with the following command:</p>
  
  <pre><code>git config --global credential.helper osxkeychain
  </code></pre>
  
  <p>And also removed my ~/.ssh directory, but not getting prompted for a password and still getting the timeout failure.</p>
  
  <p>Although I can succeed with a direct connection again:</p>
  
  <pre><code>ssh -T git@github.com
  The authenticity of host 'github.com (192.30.255.112)' can't be established.
  RSA key fingerprint is SHA256.*******
  Are you sure you want to continue connecting (yes/no)? yes
  Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
  Hi ******! You've successfully authenticated, but GitHub does not provide shell access.
  </code></pre>
  
  <p><strong>Anyone have anyway I can reset this and try to start over? Or any idea why I can authenticate with ssh -T but can't clone?</strong></p>
  
  <p>Confirmed I can still access through Xcode. Downloaded Github Desktop and authenticated because I read that would help. Still not getting prompted for a password. </p>
  
  <pre><code>brew install hub
  </code></pre>
  
  <p>This prompted me for a password, but still timed out!!!!</p>