I have a friend who has a repository in his GitHub account. I want to contribute (pull/push) to the master branch (the only branch) on that repo directly.
How would
Agreeds with falk's answer above. Check if you are a collaborator, or can he give you an access? if not follow the below steps
Go to your friends repo and fork his repo!!
On your forked repo of his copy the URL
Install git on your machine. Go to root directory on your terminal and follow the below steps
Do:
git clone URL
now do whatever edits in your cloned repo. Say you have modified a file, readMe.txt. Since you modified it on your repo!!
git add readMe.txt
Now you should commit the change
git commit -m "Dude, I have modified readMe.txt"
Now push:
you need to add your remote github repo to push changes in to your forked repository
git remote add origin https://github.com/username/myproject.git
To confirm see:
git remote -v
Now after confirming, you can push the code:
git push
Git pull:
I am assuming your friend has not added you in the list of contributors. Since you have made changes to some file, now you want to see those changes in your friends repo as well. So send him the pull request from your forked repo on to his original repo!!
By the way this is the awesome tutorial I used when I started using Git.