'Git push HTTPS with Personal access token asking for password

I cloned the origin remote repo to my local repository using my generated Personal access token. Now I want to push commit changes to my remote repository, git is asking for password.

I searched around here and I found help in setting my origin URL from SSH to HTTPS using;

git remote set-url origin https://<PERSONAL_ACCESS_TOKEN>@github.com/<Username>/<repo>.git

I confirmed the change using git remote -v its now showing

origin  https://[email protected]/<correct_user>/<right_repo>.git (fetch)                                
origin  https://[email protected]/<correct_user>/<right_repo>.git (push)

Still, when I try git push it still ask for password. Please I need help. I'm frustrated already. How can I push to my remote repo using on PAT without password prompt.



Solution 1:[1]

If you want to use PAT via URL in HTTPS you should define it this way.

git remote set-url origin https://username:[email protected]/put_username_here/repo-name.git

You are missing the username.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman Mahotskyi