Create a repo and make some file
Generate ssh key:
ssh-keygen -t rsa -C "[email protected]"
Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings. Test SSH key:
ssh -T [email protected]
clone the repo:
git clone git://github.com/username/your-repository
Now cd to your git clone folder and do:
git remote set-url origin [email protected]:username/your-repository.git
If you give a different name of the ssh id file then it is better to set an entry in .ssh/config file as follows -
Host <hostname>
HostName github.com
User <username>
IdentityFile ~/.ssh/<identityfile>
In this case on you git folder do the following -
git remote set-url origin git@<hostname>:username/your-repository.git
Now try editing a file and then do:
git add -A
git commit -am "update message"
git push
Please be careful about your RSA ids.