Setup GitHub
About this Guide
This guide will walk you through setting up your GitHub account and configuring it for the first time.
1. Create GitHub Account
- Go to https://github.com/.
- Click Sign up in the top-right corner.
- Enter your email address and click Continue.
- Create a strong password and click Continue.
- Choose a username (this will be your public identity on GitHub).
- Follow the prompts to verify your account (you may need to solve a puzzle or enter a code sent to your email).
- Choose your plan (the free plan is sufficient for most users).
- Complete the setup by answering a few questions (optional) and click Complete setup.
2. Verify Your Email Address
- Check your email inbox for a message from GitHub.
- Click the verification link in the email to activate your account.
3. Set Up Your Profile
- Click your profile icon in the top-right and select Your profile.
- Click Edit profile to add your name, bio, location, and profile picture.
- Save your changes.
4. Generate SSH Key
- When working with Git and GitHub, it’s a good idea to set up SSH keys for secure authentication.
-
SSH keys are a pair of cryptographic keys that can be used to authenticate to GitHub without needing to enter your username and password every time.
-
In your terminal, run:
-
This will create two files:
File Description ~/.ssh/id_rsaYour private key (keep this secret) ~/.ssh/id_rsa.pubYour public key (can be shared) # Example output $ ssh-keygen -t rsa -C "your-email@example.com" Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub <<< <<< <<< This is the key you need The key fingerprint is: SHA256:47MfTsMWlEN8PYpSGvYWlLd4u4fE4njqHrs53+oxEZM your-email@example.com The key`s randomart image is: +---[RSA 3072]----+ | oo. . | | o.=oo o | | . =E* o . | | o.=++ | | Sooo . | | . o.o+ | | +oOo o | | oXo*o . | | oOO*... | +----[SHA256]-----+ -
Press Enter to accept the default file location and do not set a passphrase or you will be prompted to enter it each time you use the key.
5. Add your SSH to ssh-agent
- If you are using Windows, make sure you have Git Bash installed.
- If you are using Linux, make sure you have the
ssh-agentpackage installed. - If you are using macOS, you can use the built-in
ssh-agent. - Open Terminal and run:
6. Add your SSH to GitHub
- Copy your public key to your clipboard:
- Go to GitHub site > Settings > SSH and GPG keys > New SSH key.
- Paste your key, give it a title, and save.
Adding ssh key using gh
- You can also use gh using:
gh repo deploy-key - docs:
https://cli.github.com/manual/gh_ssh-key_add
https://cli.github.com/manual/gh_repo_deploy-key
7. Test Your Setup
-
Run the following command to test your SSH connection:
-
You should see a message like: