tekiegirl
tekiegirl

Reputation: 1315

Authentication failed when pushing to a repository on GitHub (from GitHub Desktop and command line)

Problem: When I attempt to push changes to a repository I get an authentication error.

Error in GitHub Desktop:

Screenshot of error - authentication failed. Some common reasons include...

Error in command line:

With sslverify turned on:

fatal: unable to access 'https://github.com/jacquibo/neo4jDataSets.git/': SSL certificate problem: unable to get local issuer certificate

With sslverify turned off:

info: please complete authentication in your browser...
fatal: incorrect_client_credentials: The client_id and/or client_secret passed are incorrect. [https://docs.github.com/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials]
Username for 'https://github.com': [email protected]
Password for 'https://[email protected]@github.com':
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/myusername/myrepo.git/'

I have tried:

Error using the command line to test SSL certificate:

OpenSSH_8.4p1, OpenSSL 1.1.1h 22 Sep 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.121.4] port 22.
debug1: connect to address 140.82.121.4 port 22: Permission denied
ssh: connect to host github.com port 22: Permission denied

How can I fix this problem?

Only being able to edit files actually on GitHub.com is not very practical.

Upvotes: 9

Views: 33423

Answers (3)

user2015398
user2015398

Reputation: 614

File > options > Sign out of github

then sign in again

The problem will disappear

Upvotes: 0

Shanthosh Srikan
Shanthosh Srikan

Reputation: 1

It's because of not having an SSH key in your GitHub account. Follow the documentation to install SSH key to your GitHub account.

Generating a new SSH key and adding it to the ssh-agent

Upvotes: 0

peteru
peteru

Reputation: 150

You need to use SSH to access the repository, not HTTPS.

Change the URL for the remote from https://xxx to git://xxx.

You can use the green button towards the right side of the GitHub repository code page to help you get the correct URL. Change from:

HTTPS URL

to

SSH URL

The other thing you need to do is make sure you have an up-to-date local installation of Git. You may run into errors if you have an old version of Git installed.

Upvotes: 5

Related Questions