This page is a work in progress. PRs welcome!
TODO: I'm going to make instructions clearer, and add screenshots
This document covers:
Creating a GitHub account is very easy. To create a GitHub account, follow these steps:
- Open your web browser and go to GitHub's website.
- On the GitHub homepage, click on the "Sign up" button to start the registration process.
- Choose a unique username for your account.
- Provide a valid email address that you have access to.
- Create a strong and secure password for your GitHub account.
- Complete the CAPTCHA.
- Once you've filled your details, click the "Create Account" button.
- Open your email inbox and click on the verification link sent by GitHub.
- Select the GitHub plan that suits your needs and click "Continue."
- (Optional) Customize your GitHub account by adding a profile picture and filling out your profile information.
- Once your account is set up, you are good to go!
For official installation downloads and docs, see git-scm.com/downloads
Git for Windows is a complete package of all the basic git tools you'll need, with an easy GUI installer.
- Download the latest executable from the Git for Windows Releases
- Run the installer (by double clicking on the downloaded .exe file)
- Follow the on-screen instructions to install git onto your machine
- Restart explorer.exe (so the new git executable can be found)
- Run
git --version
to verify that git has been installed correctly
The easiest way to install Git on MacOS is via Homebrew.
- If you don't yet have Brew installed, install it with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Then install git with
brew install git
- Finally, verify git has been installed
git --version
On Linux, the best method for installing git is using your system's native package manager. Be sure to update your repositories first. You may need to run install commands as sudo
- Debian / Ubuntu:
apt install git
- Fedora:
dnf install git
- OpenSUSE:
zypper install git
- Gentoo:
emerge --ask --verbose dev-vcs/git
- Arch:
pacman -S git
- NixOS:
nix-env -i git
- FreeBSD:
pkg install git
- OpenBSD:
pkg_add git
- Alpine:
apk add git
When you push to a repo, or make any changes from your local machine, you've got two options for auth, HTTPS or SSH. With HTTPS you'll be prompted to enter a username + password each time you push, whereas with SSH you are authenticated automatically if once your key is setup.
SSH (or Secure Shell) authentication is a method used to establish a secure connection between a client and a server using cryptographic key pairs: a public key (which you share) and a private key (kept secret on your machine).
- You generate an SSH key pair (a public key and a private key).
- You add the public key to GitHub (or another platform).
- When connecting to GitHub, it will challenge the client to prove they have the corresponding private key.
- Your machine uses its private key to respond correctly, verifying your identity without ever revealing the key itself.
- Security: Keys are typically more complex than passwords, making them harder to crack.
- Convenience: Once set up, no need to enter a username/password with each interaction.
- Access Control: Key-based authentication allows finer-grained control, like read-only or full access.
It's essential to keep your private key secure and never share it. If someone gains access to it, they have access to everything the key provides access to. Also, using a passphrase when generating SSH keys adds an extra layer of security.
You may already have a key, in which case you can skip this step. If you do, it'll likely be in a directory named ~/.ssh/
, you can check this by running ls -al ~/.ssh
- if you see output, and a file ending in .pub
then you've already got a key!
Otherwise, we'll generate a new key by running:
ssh-keygen -t ed25519 -C "[email protected]"
Note for legacy systems
For legacy systems which does not support Ed25519 algorithm, use:ssh-keygen -t rsa -b 4096 -C "[email protected]"
When prompted, complete the form (if you choose to set a password, be sure to remember or make note of it!)
Next we should to ensure that the SSH agent is running, and that the key is added to it.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Next we need to add the public key to your GitHub profile.
Copy the contents of your newly generated SSH public key (the one ending in .pub
). You can view the file by running cat ~/.ssh/id_ed25519.pub
(if you named your key something else, update that accordingly)
Next head over to GitHub, and log into your account:
- Click on your profile photo, then click on Settings.
- In the left sidebar, click on SSH and GPG keys.
- Click the New SSH key button.
- Paste Your Key
- In the "Title" field, enter a descriptive label (like "My Laptop" or "Work PC").
- Paste your key into the "Key" field.
- Click Add SSH key.
Like other applications and services, git is configurable through a dotfile. You'll likely find your git config in ~/.gitconfig
- but it can be managed using the git config
command.
Before we make our first commit, there's a few things we need to setup in the git config. We can do this by running the following commands:
git config --global user.name "Your Full Name"
git config --global user.email "[email protected]"
That's all you need for now, but there's many other settings which can be tweaked here, such as setting shorthand aliases, default editor/ conflict / diff programs, enabling features, using plugins, etc. It's also possible (and sometimes preferable) to have different git configurations for different projects.
To learn about those, see the Git Configuration.