Home > Back-end >  Command git push origin master not working
Command git push origin master not working

Time:05-31

I have successfully connected to github through ssh as the following commands demonstrate.

Admins-MacBook-Pro-4:.ssh bobsmith$ ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address '140.82.113.4' to the list of known hosts.
Hi bobsmith76! You've successfully authenticated, but GitHub does not provide shell access.

However when I cd to the folder which has the .git files and run

git push origin master

I get

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/bobsmith/git_learn.git/'

When I vist https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ I don't really see anything very understabable about what I am supposed to do. I do see

will require the use of token-based authentication, such as a personal access token (for developers) or an OAuth or GitHub App installation token (for integrators) for all authenticated Git operations on GitHub.com. You may also continue using SSH keys where you prefer.

But I thought I had successfully used an ssh key.

CodePudding user response:

You are still trying to push via https, instead of ssh so it tries to authenticate via https.

Select the ssh-Tab from the Code-Button inside your github-repository, and change the url of the local git repository with the following command.

git remote set-url origin <git-url>

The url should look like this:

[email protected]:<User>/<Repo>
  •  Tags:  
  • git
  • Related