Creating SSH keysIn Debian GNU Linux, using the Gnome desktop, you can create a private and public SSH key pair with for example the seahorse key manager. Under File / New / Secure Shell Key.
Created keys will be visible under ~/.ssh/ the private key is called id_rsa and the public key id_rsa.pub. You should only share the public key.
At the command line, you can create keys with
ssh-keygen -t rsa -C "firstname.lastname@example.org"
Virtual Private ServerI bought a virtual private server with Debian pre-installed. A public key can be added in the file ~/.ssh/authorized_keys. When connected to the server, edit the file:
You might need to change access permission to that file as explained in this gist.
BitbucketYour public key can be added to your bitbucket account under manage account / security / SSH keys. This page explains how to use the SSH protocol with Bitbucket in more details.
GithubYour public key can be added to your Github account under profile / settings / SSH key. More details on how to generate and use SSH keys for github.
Then at the top of your Github repository you should see the "clone URL". Copy the SSH URL, in the form: email@example.com:yourusername/yourrepository.git
Add it as a remote origin:
git remote add origin firstname.lastname@example.org:yourusername/yourrepository.gitIf there was already a remote repository you might need to delete it first with git remote remove origin.
The push and set the remote repository as an upstream repository:
git push --set-upstream origin masterSubsequent push can be simply made with