SSH - Git still ask for my username and password

By xngo on May 19, 2020

I setup everything to use SSH key to connect to my Gitlab repository. I tested with ssh -T git@gitlab.com and it is showing the welcome message. But it is still asking for my username and password when I run the following command.

git pull
Username for 'https://gitlab.com':

Solution

Notice the https part of the result from the command above. Well, my current repository is still using HTTPS. I have to switch it to use SSH. I ran the following command.

git remote set-url origin git@gitlab.com:USERNAME/PROJECT_NAME.git

Clone git repository: SSH or HTTPS

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.