3

As part of the Coursera Data Scientist course set up, I incorrectly linked a directory, test-repo, to an incorrect account. So, in the statement:

git remote add origin https://github.com/yourUserNamehere/test-repo.git

I incorrectly specified the User Name. I'm thinking that I can delete the directory and reset it up again. I've researched the ability to either delete the directory or re-link it to the right account but have not found any information that can help me do so. Would appreciate some guidance.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
TheSunIsUp
  • 39
  • 1
  • 1
    you want to change your origin url to another link? just run git remote add origin your_url again, it will override it... – Surely Jun 14 '15 at 04:43
  • 1
    possible duplicate of [Change the URI (URL) for a remote Git repository](http://stackoverflow.com/questions/2432764/change-the-uri-url-for-a-remote-git-repository) – Joe Jun 14 '15 at 07:39
  • @Joe a certain duplicate. – Nick Volynkin Jun 14 '15 at 19:49

2 Answers2

1

To change the URL of a remote, use git remote set-url <name> <newurl>, in your example

git remote set-url origin https://github.com/yourUserNamehere/test-repo.git

Removing the remote and then adding it again as suggested in the comment by @xwhyLikeThis would also work.

drRobertz
  • 3,490
  • 1
  • 12
  • 23
0

You can view the existing remotes by the above command.

git remote -v

Then to reset the remote URL,you can do the following:

git remote set-url origin https://github.com/<user_name>/<repo_name>.git

To verify the new remote URL, you can type the first command again:

git remote -v
Rahul Gupta
  • 46,769
  • 10
  • 112
  • 126