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 https://github.com/username/newcopiedproject.git

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 https://github.com/username/newcopiedproject.git
$ git push -u origin master

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s