GitHub is a service for storing your code in the cloud. It’s wonderful for collaboration.
Sign up for GitHub using the same email address you used when creating your SSH key and your Git configuration.
On the next screen, you’ll see information about GitHub’s free and paid plans. To finish creating a free account, just hit the green “Continue” button.
The next screen includes a survey. You’re welcome to hit the “skip this step” link.
GitHub will send you an email after you sign up. Click the link in the email to verify that the address belongs to you.
To send and receive code between your laptop and GitHub securely, you’ll need to add your public SSH key to your GitHub account. Never copy your private key to another machine unless you are absolutely sure what you’re doing.
Copy the contents of your public key to the clipboard with the following command:
cat ~/.ssh/id_rsa.pub | pbcopy
The cat
command prints the contents of a text file to the screen—or more accurately, to STDOUT. The pbcopy
command—which is not a standard UNIX utility, but is included with OS X/macOS—copies text to the clipboard. The pipe |
takes the output from the command on the left and passes it as an argument to the command on the right.
Now go to GitHub settings to add your public key to your account.
Choose “SSH and GPG Keys” from the left menu, then click “New SSH key” on the right.
Give your SSH Key a title (something to identify the machine on which the key was generated, such as “MacBook”), and then paste in the contents that you copied from the terminal.
Return to Terminal and type the following command:
ssh -T git@github.com The authenticity of host 'github.com (192.30.255.112)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes/no)?
Go ahead and type yes
.
Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts. Hi dstrus! You've successfully authenticated, but GitHub does not provide shell access.
If you see a message like the one above, you’re ready to go!