git error: remote origin already exists

Sometime when we initialize the Local Repo, we get error: remote origin already exists.
The following step is solution.
Initialize the current folder as a Git repo:
bitnami@debian:~$ git init
bitnami@debian:~$ git remote add origin [email protected]:username/repostioryname.git
Then, error occurs:
error: remote origin already exists.
We need to remove the older origin by:
bitnami@debian:~$ git remote rm origin
Then, add the origin again:
bitnami@debian:~$ git remote add origin [email protected]:username/repostioryname.git
Add files:
bitnami@debian:~$ git add .
Commit with the descriptive message:
bitnami@debian:~$ git commit -m "Comment message"
Push the changes:
bitnami@debian:~$ git push -u origin master

Ref:
gitのエラー remote origin already existsの解決方法

Leave a Reply

Your email address will not be published. Required fields are marked *