Why Git Asks for Username and Password While Pushing to Remote Repo
This could be because the remote url is pointing to HTTPS URL and not to SSH URL.
Here's an example of -
HTTPS URL :
https://github.com/<Username>/<Project>.git
SSH URL :
git@github.com
:<Username>/<Project>.git
Now, to change from HTTPS URL to SSH URL, run the following command in your terminal:
git remote set-url origin git@github.com:<Username>/<Project>.git