Change Url of Folder[GitHub]

Photo by RetroSupply on Unsplash

Change Url of Folder[GitHub]

  1. The command for updating URL

$git remote set-url origin [new-url]

  1. Another way

    1. remove the old origin URL using the following command:
    $git remote rm origin
  1. Then, add the new origin URL for the new repository using the following command:
    $git remote add origin <new repository URL>

Note: Replace <new repository URL> with the URL of the new repository you want to initialize.

  1. Finally, push the local repository to the new remote repository using the following command:
    $git push -u origin master

This will push your local repository to the new remote repository and set the upstream branch to master. If you want to push a different branch, replace master with the name of the branch you want to push.

By using these commands, you can easily update the URL of your Git repository and initialize it to a new repository.