I would like to change a swift project from one GitHub account to another account. I want to commit the project to another account but I get an error - I assume I need to remove the .git file from the project but the answer here is not working for me.
Asked
Active
Viewed 47 times
1 Answers
0
Why do that?? No, all you have to do is define the new repo, push to it, then remove the other one. Each Git repo is on a local machine. That repository can be synced with one or more remote repositories. Right now, you probably have GitHub (account 1) setup as origin (a remote). What I would do is:
- rename origin to oldrepo or something
- create origin with the new url
- push to it
Then you can remove the old one.
To edit your remotes, you can either do commands:
git remote remove origin, get remote add origin <newUrl>
or you can edit the .git/config file with an editor.

Rob
- 11,446
- 7
- 39
- 57
-
I am getting the error "failed to add file xxx to index." What I did was stupid but this isn't a huge project - but I deleted the repository from my original account and now I am no longer able to commit under the new/old account – Andrew Webber Dec 08 '17 at 05:47
-
In that case I would erase .git and then do git init, add all the files, commit, and then add the remote again pointing to the new repo. NEVER destroy history though.. :) – Rob Dec 08 '17 at 05:50