How to Copy Your SSH Key to Your Github Repository Using Chromebook (2024)

TECH NOTES FOR NEWBIES

How to Copy Your SSH Key to Your Github Repository Using Chromebook (2)

Github is amazing when you know how to use it. But when you don’t, it’s the bane of your existence. Couple that with little to no instructions on how to set up your Chromebook to work with Github, and you either:

  1. Want to toss your laptop through the window the way Uncle Phil throws Jazzy Jeff out of the mansion
  2. Stay up until 3:30 AM, determined to defeat Git (and lose), or
  3. A little bit of both.

Disclaimer: Please do not toss your laptop out of the window. The fact is, a lot of people have asked about this online because it’s a common frustration. You are not alone, and you’ve got this!

OK. Let’s assume you’ve already done the following:

  1. Added Linux & VS Code onto your laptop. If you haven’t done this yet, start here.
  2. Created a Github account.
  3. Created a repository on your Github account.

A few things to clarify before getting started:

Local: This term refers to your local drive and server. Think your computer, where you are currently typing and storing files.

Remote: This term refers to the server from which you’d like to push and pull files. In this case, the remote server is Github.

SSH: This is short for Secure Shell. SSH is an encryption tool that allows you to log into your remote server safely. You can get into the weeds here.

XYZ Project: This represents the folder that contains all of the contents you will need to push to your remote server. It is also the name of your repository in this scenario. Whenever this appears in the steps below, use the name of your folder and repository.

This isn’t as scary as it looks.

Sounds complicated though. Why not use HTTPS?

I had the same thought. I was already using HTTPS, but Github busted my groove. I was in the middle of creating a branch and wanted to push the file onto my remote server but was stopped by Github! As of November 2021, Github requires users to communicate with the remote server using SSH keys for login from the local terminal. I, therefore, had no choice but to figure this out.

Using Chromebook and SSH keys for Github took some investigating, trial and error, and significant sleep loss. So to ensure you won’t stay up until 3 AM figuring this out, here are clear step-by-step directions on how to retrieve your SSH key, set it up, copy it to Github, and get back to coding.

STEP ONE: Make sure you’re in the right place on your computer.

  1. Open your terminal.
  2. Ask your terminal where you are by typing this: pwd
  3. You want to get to the folder where you’ve cloned your repository because that is where you are communicating with Github. For example: if the terminal says you’re at /home/YOURNAME, but the files that will be pushed or pulled are in the “XYZ-Project” folder, get to the XYZ-Project folder before going to the next step.

Remember, you can get to your folders by using the command for cd. Use cd to get to the XYZ-Project folder in the same way you would if you were using your mouse and going further into subfolders. Example:

In the command line, type: cd ‘XYZ-Project’. If the terminal says no or says the file doesn’t exist, and you know it does, ensure you’ve spelled the name of the folder correctly. If that isn’t the issue, it’s because your file is buried in subfolders. Remember: you’re typing what you’d typically use your cursor to do. If you’d normally have to go to Documents, then a folder called Projects 2021, then XYZ-Project using a cursor, you’d type that out here in the command line.

Here’s how that looks: cd ‘Documents’ (hit enter), then cd ‘Projects 2021’ (hit enter). Finally, type cd ‘XYZ-Project’ (hit enter). Sometimes I can’t remember which folder something is in, so don’t forget to use ls to see which subfolders exist in a big folder.

Now that you’re in the right place, we can communicate with the remote server. The assumption, at this point, is that you’ve at least cloned the XYZ-Project folder from your Github repository.

STEP TWO: Create an SSH Key on your local server.

  1. Check to make sure you don’t already have SSH keys here. In the command line, type ls -al ~/.ssh
  2. If nothing appears, you’re good to go. If something appears and a line ends in id_rsa, then this means you have a key already, and you can choose to overwrite it or use this key.
  3. Now you can generate your key. Do this by typing in the command line: ssh-keygen -t rsa -b 4096 -C “YOUR@GITHUBEMAIL.COM(Type the email address used to sign up for your Github account).
  4. If that doesn’t work, type in the command line: ssh-keygen -t rsa
  5. The command will then request a file to save the key. Just hit enter. You will then need to enter a passphrase, which will be for your SSH key. Careful here; you cannot see the phrase as you’re typing it. Hit enter. Remember this passphrase — you will need it for step 7.
  6. Now you need to link your local computer to the ssh-agent. Do this by typing the following into the command line: eval “$(ssh-agent -s)”.
  7. If you see a line that says: Agent pid #### (where # will show up as numbers in the terminal), you’re good to go. Move to the next step.
  8. Type the following command: ssh-add -K ~/.ssh/id_rsa
  9. Remember that passphrase you entered on step 4? The command line should now prompt you to enter it here. If you forgot the passphrase, you could generate a new key by going back to step 3. At some point, the terminal may ask if you want to write over the previous key you created. Just say yes.

STEP THREE: You’re Unable to copy the SSH key based on the previous step. Do this:

  1. The commands clip < ~/.ssh/id_rsa.pub and pbcopy < ~/.ssh/id_rsa.pub ARE NOT GOING TO WORK.
  2. In the command line, type cat ~/.ssh/id_rsa.pub
  3. Your key appears! It will be long and full of letters, numbers, and intermittent “+” signs. The prefix of this long key is going to be: ssh-rsa. You will also see your email address at the end of the key. The email address is also part of the key. Beginning with the prefix, highlight and copy the entire key by highlighting it with your cursor. Hint: when you release the cursor, a small notification will flash onto the screen saying “Copied.”

STEP FOUR: Add your SSH key to the remote server (Github).

  1. Go to your Github settings. A list of account settings will appear to the left of the page.
  2. Under account settings, select “SSH and GPG Keys.”
  3. Select the button that says “New SSH Key.”
  4. In the title, label the key. It’s recommended you name it after your local hardware. So in this instance, it would be “Chromebook.”
  5. Paste the key you copied from your terminal into the space that says “Key.”
  6. Select Add SSH Key to save.

YOU DID IT.

But there is one more thing you need to do: change the protocol so that your terminal doesn’t prompt you to use the password but instead uses your SSH key.

  1. Go back to your terminal. You should still be in your project folder. You can check by asking your terminal where you are (the command is pwd). If you’re not in your project, use the change directory command (cd) to get there.
  2. Next, remove the “HTTPS” setting from your folder. In the command line, type git remote rm origin. It’s going to look as if nothing happened. This is good.
  3. Next, go to your repository in GitHub. Select the repository that correlates to your project. Then select the code button for your repository. This is where you found your HTTPS link initially. This time, you’re going to use the SSH link instead. Copy the SSH link.
  4. Go back to your terminal and type git remote add origin, and next to it, paste the link you just copied from your repository. It should look like this: git remote add origin git@github.com:YOURGITUSERNAME/NAMEOFREPOSITORY.git.
  5. For clarification: paste the link directly next to the command git remote add origin. Only after you add the link should you select enter. After this, it should look like nothing happened.
  6. But it did. To check, type git remote -v
  7. Two links will show up. But you will not see HTTPS in the links, and that’s how you know it worked!

From this point, you’re good to go, and your repository is now set up with this SSH code.

How to Copy Your SSH Key to Your Github Repository Using Chromebook (2024)

FAQs

How do I copy my SSH key to GitHub? ›

Adding a new SSH key to your account
  1. Copy the SSH public key to your clipboard. ...
  2. In the upper-right corner of any page, click your profile photo, then click Settings.
  3. In the "Access" section of the sidebar, click SSH and GPG keys.
  4. Click New SSH key or Add SSH key.

How do I copy my SSH key? ›

Copy the ssh key into remote servers
  1. Open a terminal on your local computer.
  2. Generate an SSH key pair if you haven't already done so by running the command: ssh-keygen . ...
  3. Once the key pair is generated, run the command: ssh-copy-id user@remote_server . ...
  4. You'll be prompted to enter the password for the remote user account.
Apr 8, 2023

How to use SSH key to push to GitHub? ›

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)
  1. Create a repo. Make sure there is at least one file in it (even just the README.md)
  2. Generate a SSH key pair (private/public): ...
  3. Copy the contents of the public SSH key. ...
  4. Copy the public SSH key to GitHub. ...
  5. Test the SSH key:

How do I add a SSH key to Git? ›

How to Add an SSH Key to your Github Account
  1. Log into your GitHub account.
  2. Click your avatar and choose Settings.
  3. Select SSH and GPG keys.
  4. Click New SSH key.
  5. Enter a title in the field.
  6. Paste your public key into the Key field.
  7. Click Add SSH key.
May 3, 2024

How to copy and paste to SSH? ›

use the mouse to open the context menu and click the Edit > Paste option. hit Ctrl + V on the keyboard. use the keyboard to access the context menu's Edit > Paste option: Alt + Space , then E , then P. if the "Use Ctrl+Shift+C/V as Copy/Paste" option is activated, hitting Ctrl + Shift + V on the keyboard.

How to SSH into a GitHub repo? ›

Set up SSH
  1. Step 1: Generate SSH Key Pair. The first step is to generate the SSH key pair. ...
  2. Step 2: Add Key To GitHub. After generating the key pair, add the public key to the service you want to connect to over SSH. ...
  3. Step 3: Test the Connection. ...
  4. Step 4: Check Local SSH Agent. ...
  5. Step 5: Add Keys to SSH Agent.
Nov 2, 2023

How to use SSH key to clone git repository? ›

Terminal or an alternative command line tool on your Mac.
  1. Step 1: Generate SSH Key. First, let's generate an SSH key pair. ...
  2. Step 2: Add SSH Key to SSH Agent. Now, let's add the SSH key to the SSH agent on your Mac. ...
  3. Step 3: Add SSH Key to GitHub. ...
  4. Step 4: Clone Repository. ...
  5. Step 5: Verify Cloning.
Apr 2, 2024

How to use SSH key GitHub terminal? ›

Steps to connect GitHub to SSH :
  1. Launch Terminal / Git Bash.
  2. Paste the below command and substitute your GitHub email address: $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. Press Enter when prompted “Enter a file in which to save the key”.
  4. Type a passphrase of your choice.
Apr 21, 2020

How do I pull a SSH key from GitHub? ›

To perform a GitHub clone with SSH keys in Git, simply follow these steps:
  1. Create an SSH keypair on your Windows or Linux OS.
  2. Copy the value of the public SSH key to your GitHub account.
  3. Obtain the GitHub SSH URL for the repository to be cloned.
  4. Using Git, clone from GitHub with the SSH URL.
Jan 11, 2022

How do I manually add SSH key? ›

Adding your SSH key to the ssh-agent
  1. First, check to see if your ~/. ssh/config file exists in the default location. $ open ~/. ...
  2. If the file doesn't exist, create the file. touch ~/.ssh/config.
  3. Open your ~/. ssh/config file, then modify the file to contain the following lines.

How to generate a SSH key for GitHub? ›

ssh-keygen -t rsa -b 4096 -C "[your github's email]" # Creates a new ssh key # Generating public/private rsa key pair. This will generate a key for you. You have to copy that and insert into your Github's account (just one time). Then add the key we just generated.

How do I generate a SSH key? ›

For Windows 10 & 11
  1. Press the Windows key or open up the Start Menu. Type “cmd”.
  2. Under “Best Match”, click “Command Prompt”.
  3. In the command prompt, use the ssh-keygen command: ...
  4. The system will now generate the key pair and display the key fingerprint and a randomart image. ...
  5. Open your file explorer.

How do I add SSH key to GitHub organization? ›

Next to the organization, click Settings. In the "Security" section of the sidebar, click Authentication security. To the right of "SSH Certificate Authorities", click New CA. Under "Key," paste your public SSH key.

How do I find my SSH key for GitHub? ›

Checking for existing SSH keys
  1. Open Terminal .
  2. Enter ls -al ~/. ssh to see if existing SSH keys are present. ...
  3. Check the directory listing to see if you already have a public SSH key. ...
  4. Either generate a new SSH key or upload an existing key.

How to clone SSH in GitHub? ›

To perform a GitHub clone with SSH keys in Git, simply follow these steps: Create an SSH keypair on your Windows or Linux OS. Copy the value of the public SSH key to your GitHub account. Obtain the GitHub SSH URL for the repository to be cloned.

How do I push code to GitHub? ›

Using Command line to PUSH to GitHub
  1. Creating a new repository. ...
  2. Open your Git Bash. ...
  3. Create your local project in your desktop directed towards a current working directory. ...
  4. Add the file to the new local repository. ...
  5. Add the URL copied, which is your remote repository to where your local content from your repository is pushed.

Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6702

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.