Question

I cloned Original Repo A after adding remote Upstreams/fetch etc. I then forked A which we call F. Now I made changes in files of A and ran git add command to add them. I tried to push them and got 403 error which made me realised I made changes in wrong folder.

Now I cloned F on machine now. Is it Ok if I just copy edited files from A to F and push them on my own forked folder or I make changes manually?

Was it helpful?

Solution

As F is a fork of A, you can just continue to use your local clone of A to push to F. To do that, you simply need to add your fork as a remote:

git remote add fork git@github.com:user/fork.git

Then you can do git fetch fork to fetch from your fork, and git push fork master to push to the master branch of the fork instead of the original repository.

If you prefer to have your fork as the repository named origin, you can also rename them and give the original repository A the name upstream. That is how the repositories are traditionally named. To rename them, you can do this:

git remote rename origin upstream
git remote rename fork origin

Now, your fork is named origin, and the fork’s original repository A is available as upstream.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top