DEV Community

Kiran (AK) Adapa
Kiran (AK) Adapa

Posted on

How to Push Changes from a Cloned GitHub Repo to Your Own Repository

You starred a great github (open source) project. You love this project and wanted to work on it on your own.

You clone that project from github to your local.
Now, what?

Make a brand new github repository under your own account and start using that repo.

For many, it is a vary basic activity and requires just a couple of steps. But, how do you do it?

When you clone a repository from GitHub, the remote named origin points to the source repository. If you want to make changes and push them to your own GitHub repository (not the original), follow these steps

  1. Create a new repo on GitHub.

  2. Change the remote URL in your local clone.

  3. Push your changes to your new repo.

  4. Confirm everything on GitHub.

That second step is the key step.

When you clone a repo, the project's git remote is still pointed to the

$ git remote -v

origin  https://github.com/open-source-org/great-project.git (fetch)
origin  https://github.com/open-source-org/great-project.git (push)
Enter fullscreen mode Exit fullscreen mode

You update the origin to your newly created github repository url!

$ git remote set-url origin https://github.com/your-gh-profile/great-project.git

Now, if you display the git remote using the following command
$ git remote -v

You see this...

origin  https://github.com/your-gh-profile/great-project.git (fetch)
origin  https://github.com/your-gh-profile/great-project.git (push)
Enter fullscreen mode Exit fullscreen mode

That's it!

From now on, whenever you make changes and push changes from your local these updates/additions go to your github repository.

Reference(s):

Top comments (0)