GitHub has terminated the login from password in command line. You can switch to SSH. This tutorial will guide you how to do it.
Git switch from password to SSH
What I do is switch remote URLs from HTTPS to SSH. By doing this, the password prompt is no longer there and I can push directly.
Usually we use
git clone https://github.com/USERNAME/repo.git to get the clone the remote repo to local machine. It’s one of the easiest way.
But whenever we want to
git push to the repo, it’s asked for our username and personal access authentication, token. We can switch from HTTPS to SSH.
- List existing remotes
git remote -v > origin https://github.com/USERNAME/REPOSITORY.git (fetch) > origin https://github.com/USERNAME/REPOSITORY.git (push)
- Change remote’s URL from HTTPS to SSH with
git remote set-urlcommand. It’s available at repository clone button.
$ git remote set-url origin firstname.lastname@example.org:USERNAME/repo.git
- Verify by using the commands again:
$git remote -v > origin email@example.com:USERNAME/REPOSITORY.git (fetch) > origin firstname.lastname@example.org:USERNAME/REPOSITORY.git (push)