0

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.)

Hermi
  • 350
  • 2
  • 5
  • 16
  • 2
    Just run the command again with the old git url. Or edit `.git/config` and change it manually there. – match Dec 24 '22 at 16:58
  • @match I did that, but I'm still being asked for username and password, which still don't get accepted. It's ok if the old link is used, but I want it to be as in the past where I did not have to provide username + passwd for git pushes. – Hermi Dec 25 '22 at 05:37
  • Private key implies you should have an ssh:// url not an https:// one? – match Dec 25 '22 at 11:17
  • Thanks a lot, this must be it... In my `config` file in `.git`, I have an entry of the form `url = https://gitlab.com//.git`, can I just change it to `url = git@gitlab.com:/.git`? – Hermi Dec 25 '22 at 19:30

0 Answers0