Having a local GIT repository linked to a remote which is not existing anymore is a problem I faced multiple times in the last time, so I thought I should document this. The steps are as follows:
- Identify old non-existing remote and delete it
- Add new remote
- Push all branches
Step 1: Identify…
1 2 3 |
$ git remote -v origin user@git.server.com:path/to/repo (fetch) origin user@git.server.com:path/to/repo (push) |
… and delete …
1 |
$ git remote rm origin |
… old remotes.
Step 2: Add new remote
1 |
$ git remote add origin ssh://user@git.new.server.com/path/to/repo.git |
Step 3: Push all branches to new remote
1 |
$ git push --all origin |
Now, all branches should be pushed to the new repository.