I git novice I typed too many names like origin for "git remote add origin git@github.com:f/ps.git" so if I even delete the repository from git hub and try again to add the same command I am getting the error fatal: remote origin already exists. where I can see all these name i have typed and how can I delete them from git hub?
Asked
Active
Viewed 278 times
0
ocean
- 75
- 2
- 9
2 Answers
3
You can list all the remotes using:
git remote -v
You can delete a remote by doing
git remote remove name
where name is one of the remote names, in your case origin.
So all you need to do (after verifying you want to replace the origin remote with something else:
git remote remove origin
git remote add origin url
where url is the remote's URL.
rubenvb
- 74,642
- 33
- 187
- 332
1
There are a few ways to do that :
1) run git remote remove origin
2) If you have too many remote, it may be simpler to edit the .git/config file in your repository, it contains all remote aliases. It looks like this :
[remote "pub"]
url = ssh://blabla@somewhere/home/myself/git/ourproject.git
fetch = +refs/heads/*:refs/remotes/pub/*
[remote "jco"]
url = ssh://blabla@somewhere/home/jco/git/ourproject.git
fetch = +refs/heads/*:refs/remotes/jco/*
Denys Séguret
- 372,613
- 87
- 782
- 758