Reputation: 6983
I’m supposed to work on my client's project on GitHub, where the changes would be on his repository. I tried to follow the fork example, but could only get the changes to go to my account repository?
In the example on GitHub, to fork a repo, they create a remote called upstream
to point to the original project. I can get the changes from it by
get fetch upstream
git merge upstream/master
I was able to upload the changes into my repo by
git push –u origin
which copied my changes to my account.
I tried
git push –u upstream
To push my changes on the original account. I got the following error
You can’t push to git://github.com.octocat/SpoonKnife.git use [email protected]/Spoon0-Knife.git
Upvotes: 3
Views: 14023
Reputation: 67589
Basically, in order to collaborate with your client, you've got two main options:
pull request
(more info on this in this GitHub help item). This allows your client to review, discuss and/or request some changes to your proposal before merging it.committer
to their project. This would allow you to directly push your commits to their repository, without the need for a fork/cloned repository on your side.As a side note, Spoon-Knife.git is one of GitHub's read-only repository (used for demonstration purpose) and you will not be able to commit to that (unless your client is GitHub). Thus, your client's upstream
git remote should point to a different repository
Here are the steps (to be followed after you forked and cloned the repository to your local disk):
git remote rm upstream
git remote add upstream git@xxxxxx
git push -u upstream master
. git push -u
will set the HEAD of the remote repository.git pull upstream master
If you prefer the name origin replace upstream with origin, but still follow step 1 to remove the reference to Spoon-Knife.git. Then in step 2 - git remote add origin git@xxxx
.
Upvotes: 7
Reputation: 388
git://github.com.octocat/SpoonKnife.git is a read-only URL. As GitHub suggests, the corresponding write-able URL is [email protected]/Spoon0-Knife.git. If you want to be able to push on the upstream repository, you will have to ask (to the upstream team, i.e., your customer) to be added as a committer.
Upvotes: 1