51

VS Code is my actual IDE and git client for all my projects. I'd like to change the origin remote of an actual repository.

How can i do it?

0

2 Answers 2

114

It can be done over the terminal. (VS code has a terminal)

  1. Go to the root of the directory.

  2. List your existing remotes in order to get the name of the remote you want to change.

    $ git remote -v
    origin  [email protected]:USERNAME/REPOSITORY.git (fetch)
    origin  [email protected]:USERNAME/REPOSITORY.git (push)
    
  3. Change your remote's URL from SSH to HTTPS with the git remote set-url command.

    $ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
    
  4. Verify that the remote URL has changed.

    $ git remote -v
    origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    origin  https://github.com/USERNAME/REPOSITORY.git (push)
    
1
  • thanks, every things works fine with terminal but not with GUI Source Control menu! any thing to do? Apr 16 at 12:03
14

You can do it using GUI with the following steps

  1. Click on Source Control on the sidebar and click on more actions

enter image description here

  1. Go to Remote and use the options Add Remote and Remove Remote

enter image description here

3
  • 4
    Am I missing something, or is there no way to list all the remotes, and then edit a remote?
    – RoyM
    Dec 21, 2022 at 15:08
  • Ok but how do you select your remote?
    – IronSean
    yesterday
  • I can't find a feature that lists remotes. But I installed an extension "Just Enough Git" which shows the "Remotes" section Inside the "Source Control" tab. Hope this helps. 14 hours ago

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.