NefariousOctopus
NefariousOctopus

Reputation: 857

Github - clone repo then push to my fork

I am new to git so please go easy on me :)

I have cloned a repo from Github and made some local changes. But now I would like to fork the original repo and push local changes to the forked repo.

Is this possible?

Upvotes: 0

Views: 78

Answers (3)

U r s u s
U r s u s

Reputation: 6968

The other answers are ok, but I would also advise you to have a good look at this really good resource.

It includes the answer to your question and much more. I find the examples of different workflows one may use really helpful.

Upvotes: 0

Aseem Baranwal
Aseem Baranwal

Reputation: 314

Yes you can definitely do that! After forking the repository that you wish to fork, then either add a new remote url or change the remote origin in your locally cloned repository.

To add a new remote url, use:

git remote add <new_name> <the_new_URL>

To change the remote origin, you may edit the .git/config file in your local repository directory. Hope this helps!

Upvotes: 1

ryanpcmcquen
ryanpcmcquen

Reputation: 6445

Fork the repo (by clicking Fork on GitHub) and add a new remote:

git remote add hub YOUR-CLONE-URL

Then simply add, commit, push (git push -u hub master).

If you can provide a link to your fork I can give you the exact commands.

Upvotes: 1

Related Questions