As described in the accepted answer of this SO question, we should use
git remote set-url origin new.git.url/here
Personally, I used the -v
option as well, i.e.
git remote -v set-url origin https://gitlab.com/<user_name>/<new_name>
However, when I now do
git push origin main
I'm being asked for git username and password and my credentials don't get accepted. So I want to abort the above command of setting the remote url, how do I do this? (Usually, I'm not being asked for my git username and password when I do git push
, only for the password of the private key.)