GitHub Logo

Configuring Your GitHub Account

Overview:

  1. Configure your GitHub account for secure logins via ssh and/or https

  2. Set up notifications on repositories you own or follow

Prerequisites

Concepts

Importance

Notes

What is GitHub?

Necessary

GitHub user account required

GitHub Repositories

Necessary

Issues and Discussions

Recommended

Cloning and Forking a Repository

Recommended

  • Time to learn: 35 minutes


GitHub secure key generation

When you signed up for your free account on GitHub, you established a user ID and its corresponding password. Many of the repositories that GitHub serves are readable from anywhere, not even requiring a GitHub account.

However, especially when you use the git command-line interface to access a GitHub-hosted repo, there are cases when you need to provide an additional set of login credentials. Some of these cases are:

  1. When you want to clone a private, as opposed to public GitHub repository (read-access)

  2. When you wish to push to a repo (write-access)

For these use-cases, you won’t be able to simply type your GitHub user ID and password from the command line. Instead, you need to set up access tokens that live in two places: in your GitHub account, and in your local computer’s file system.

GitHub supports two means of key-based access: via https, and via ssh.

For example, one can clone Project Pythia’s Sandbox repository using a URL for the https protocol:

GitHub Clone https

The URL in this case is https://github.com/ProjectPythia/github-sandbox.git

Similarly, if you click on the SSH tab:

GitHub Clone ssh

Here, the URL is git@github.com:ProjectPythia/github-sandbox.git

Generate a secure personal access token for https

First, you will create a secure token in your GitHub account settings, and then use the token on your local computer.

Follow the steps with helpful screenshots at GitHub’s PAT Creation page.

Tip:

If using the https protocol to push to a remote repo, you must have generated and downloaded a personal access token. You may also need it when cloning, if the remote repo is not open to all.

Generate an SSH public/private keypair

First, on your local computer, you will create an SSH public/private keypair, and then upload the public key to your GitHub account.

Follow the steps with helpful screenshots at GitHub’s Connecting to GitHub with SSH page.

Tip:

If using the ssh protocol to clone or push, you must have generated and created an ssh key-pair.


HTTPS vs SSH: Either is fine!

Either https or ssh works fine. Choose whatever you prefer. See this overview of the pros and cons of each protocol.


GitHub notifications

In keeping with the social network aspect of GitHub, you can follow particular repositories that are of interest to you. Additionally, once you begin contributing to a repository, you may wish to be notified when Pull Requests are made, Issues are posted, your code review is requested, and so on. While it’s easy to have GitHub email you at the address you used when you registered for your GitHub account, you may wish to avoid email clutter.

Email notifications

Let’s say you wish to monitor (or watch) the Project Pythia GitHub Sandbox repository and receive emails about it.

Click on the Watch link near the top of the page:

GitHub Watch

You can then select what type of notifications you wish to receive. For example, you may want to receive all notifications related to that repo:

GitHub Watch All Activity

You will then receive email at the address you used when you signed up for GitHub whenever activity occurs on that repo.

GitHub Unwatch

You can stop watching that repo by just clicking on the now-labeled Unwatch link again, and choosing Participating and @mentions to toggle it back to Unwatch.

Stop spamming me, GitHub!

It’s easy to become overwhelmed with email from one or more repos that you are following and/or participating in! In this case, you may wish to disable email notifications. In order to set your notification settings, go to https://github.com/settings/notifications. You can, for example, uncheck the Email boxes to cease receiving notifications that way:

GitHub Notification Settings

If you turn email notifications off, get in the habit of clicking on the Notifications icon when logged into GitHub:

GitHub Notifications

You can click on the Notifications icon and scroll through all notifications from repos that you opted into receiving notifications from:

GitHub Notification Browser

Use the Filter notifications control to display only those that meet certain criteria. For example, say you only wanted to view topics related to the MetPy repo:

GitHub Notification Filter

Tip:

In the list of notifications, you can unsubscribe as shown below.

GitHub Notification Unsubscribe

Summary

  • GitHub uses secure tokens to enable write (and sometimes read) access to GitHub repositories.

  • You can opt-in to notifications on a repo. The default, which can be easily changed, is to receive email.

What’s Next?

In the next section, we will learn the basics of version control using command-line git.

References

  1. GitHub Personal Access Token (https)

  2. GitHub Public/Private Keypair (ssh)

  3. Remotes in GitHub (Carpentries Tutorial)