How to copy an external repository to your github

If you want to add/copy an external project (that already uses git) to your github then follow these steps:

– Enter on your github and create a new repository;
– Clone the original project (this project external to github) to your disk;
– Points its origin to github repository:

$ git remote add origin

At this moment you probably will receive this error message:

"fatal: remote origin already exists."

To solve it execute:

$ git remote -v

You will see that this project is pointing to original repository from project’s author.
Then you need to remove this origin using this command:

git remote rm origin

Finally you can add the new repository and push everything to there:

$ git remote add origin
$ git push -u origin master