How to change the Github remote repository?

Asked

Viewed 303 times

1

I have a project finalized and commissioned at Github. Now I want to make a copy of the folder to do some tests and I want to send this project to a new repository on Github. The problem is that this copy is being directed to the repository of the first version and I don’t want to touch the first version, I want to commit to a new repository.

How do I unlink the repository of the old project in this new copy of the previous project?

Note: I have already made many changes to the new project and I do not want to miss it.

1 answer

3


Open Terminal and go to the project folder.

Change the current working directory for your local project. List your existing remotes 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)

Change the SSH remote URL to HTTPS with the git remote set-url command.

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

Check that the remote URL has been changed.

$ git remote -v
# Verify new remote URL
> origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin  https://github.com/USERNAME/REPOSITORY.git (push)
  • blz. the name of the first project is gymManager and the copied folder I changed the name to gymBD. when I downloaded the gymBD folder did the "$ git remote -v" appeared the name gymManager. i now need to create a new repositorio gymBD on github and run "git remote set-url"?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.