Configure your GitHub account for secure logins via ssh and/or https
Set up notifications on repositories you own or follow
GitHub user account required
Time to learn: 15 minutes
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, such as:
When you want to clone a private, as opposed to public GitHub repository (read-access)
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 ssh.
For example, one can clone Project Pythia’s Sandbox repository using one URL for the https protocol:
The URL in this case is https://github.com/ProjectPythia/github-sandbox.git
Similarly, if you click on the SSH tab:
Here, the URL is email@example.com:ProjectPythia/github-sandbox.git
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.
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.
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.
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.
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.
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:
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:
You will then receive email at the address you used when you signed up for GitHub whenever activity occurs on that repo.
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.
It’s easy to become overwhelmed with email from one or more repos that you are following and/or participating in! Instead, you may wish to disable email notifications. In order to set you notification settings, go to https://github/settings/notifications. You can, for example, uncheck the Email boxes to cease receiving notifications that way:
Instead, get in the habit of clicking on the Notifications icon when logged into GitHub:
You can click on the Notifications icon and scroll through all notifications from repos that you opted into receiving:
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:
In the list of notifications, you can unsubscribe as shown below.
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.