Shadat Rahman
Shadat Rahman

Reputation: 133

Can not Push on Github through Ubuntu Terminal

I am trying to push to github from my Ubuntu machine. I am able to Push from Visual Studio Code terminal, but can not Push from Ubuntu Terminal or Android Studio Terminal. Every time I try to Push from Terminal or android studio terminal, it asks for username and password. Even though I enter my valid username and password it says

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/mdshadatrahman/advanced_flutter.git/'

I have added ssh key using ssh-keygen -t rsa -b 4096 -C "myemailaddress"
But I can push form VS Code Terminal without any problem.
How can I solve this problem?
Thanks


Almost forgot to add - I am able to Push using Android Studio shortcut(CRTL + SHIFT + K).

Upvotes: 1

Views: 2116

Answers (1)

Daniel
Daniel

Reputation: 1490

Looks like the remote uses the HTTPS protocol (password based) instead of SSH (key based).

$ git remote -l

should list your remotes, e. g.

origin  https://github.com:darmiel/eeee (fetch)
origin  https://github.com:darmiel/eeee (push)

If your origin remote starts with https:// you're on the wrong protocol. Change the HTTPS remote to SSH using git remote set-url:

$ git remote set-url origin [email protected]:darmiel/eeee.git

you can see the SSH url by clicking on the "Clone" button on GitHub: enter image description here

Upvotes: 1

Related Questions