RockBoro
RockBoro

Reputation: 2473

why error connecting to github from powershell command line?

first time using GitHub.
Created the repository on github.com. Now I want to push to that repository. Getting "connection failed" error.

When I run "ssh -Tv [email protected]" I get "connection timed out".
And "ssh -T -p 443 [email protected]" fails with: Permission denied.

I turned off the windows firewall. Same error.

What to do? How to connect to GitHub?
I am using VSCode. Working from the powershell command line.

Here are the commands I tried:

    PS C:\gitsteve\maker> ssh -Tv [email protected]
OpenSSH_7.1p2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.255.112] port 22.
debug1: connect to address 192.30.255.112 port 22: Connection timed out
debug1: Connecting to github.com [192.30.255.113] port 22.
debug1: connect to address 192.30.255.113 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out

PS C:\gitsteve\maker> git push -u origin master
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

PS C:\gitsteve\maker> ssh -T -p 443 [email protected]
The authenticity of host '[ssh.github.com]:443 ([192.30.253.123]:443)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.253.123]:443' (RSA) to the list of known hosts.
Permission denied (publickey).

PS C:\gitsteve\maker> ssh-add -l
Could not open a connection to your authentication agent.

PS C:\gitsteve\maker> ssh -T -p 443 [email protected]
Warning: Permanently added the RSA host key for IP address '[192.30.253.122]:443' to the list of known hosts.
Permission denied (publickey).

Please make sure you have the correct access rights
and the repository exists.

PS C:\gitsteve\maker> ssh-agent -s
SSH_AUTH_SOCK=/tmp/ssh-W7z0JBkeNSBz/agent.14164; export SSH_AUTH_SOCK;
SSH_AGENT_PID=14148; export SSH_AGENT_PID;
echo Agent pid 14148;

PS C:\gitsteve\maker> ssh-add -l -E md5
Could not open a connection to your authentication agent.

PS C:\gitsteve\maker> ssh -T -p 443 [email protected]
Permission denied (publickey).

Upvotes: 1

Views: 1974

Answers (1)

VonC
VonC

Reputation: 1323553

If SSH is blocked for any reason, try and switch to an https URL

 cd /path/to/repo
 git remote set-url origin https://github.com/<username>/<reponame>.git

Then try again

 git push -u origin master

Then first time, it should require your GitHub username/password (which has nothing to do with the passphrase you might have set on your private SSH key: it needs your GitHub account password)

If you have installed a Git credential helper (as in this answer), those GitHub credentials will be cached (meaning vscode won't ask you again for username/password at the next push)
Check first the value of git config credential.helper: if you see manager, you have nothing to do.

Upvotes: 1

Related Questions