DEV Community

Emily Sibbald
Emily Sibbald

Posted on

Explain GitBash Like I'm Five

I've never used GitBash before, I'm trying to add my SSH key and I've only successfully managed to create two new SSH keys, I'm not certain how to add them to GitBash or to GitHub so I can start saving my work to my laptop for school. Fill me in please!

Top comments (2)

Collapse
 
biocoderr profile image
Pranav Swaroop Gundla

GitBash is a magic box that lets you talk to your computer using words instead of clicking buttons. It's like having a secret code that only you and your computer can understand. With GitBash, you can tell your computer to do things like save a copy of your work or show you all the changes you made to a file. It's like having a special superpower that helps you work faster and smarter!

To add your SSH keys to GitBash and GitHub, follow these steps:

  1. Open GitBash on your computer.
  2. Type cd ~/.ssh to navigate to your SSH directory.
  3. If you see files named id_rsa and id_rsa.pub, those are your SSH keys. If you don't see them, you may need to create new SSH keys by typing ssh-keygen -t rsa -b 4096 -C "your_email@example.com" and following the prompts.
  4. Copy the contents of the id_rsa.pub file to your clipboard. You can do this by typing cat id_rsa.pub and then selecting the text with your mouse.
  5. Log in to your GitHub account and go to Settings > SSH and GPG keys.
  6. Click on the "New SSH key" button.
  7. Paste the contents of your id_rsa.pub file into the "Key" field.
  8. Give your SSH key a title (e.g. "My Laptop").
  9. Click "Add SSH key" to save your key.

Now, GitBash should be able to securely connect to your GitHub account without needing to enter your password every time. To test that everything is working correctly, try typing ssh -T git@github.com in GitBash. You should see a message that says "Hi ! You've successfully authenticated, but GitHub does not provide shell access."

I hope this helps!

Collapse
 
rahulbohra profile image
Rahul Bohra

Okay, so let's imagine you have a toy box with all your favorite toys inside. Sometimes you want to play with one specific toy, but you don't want to take everything out of the box to find it, right?

GitBash is like a magic tool that helps you find your toy quickly and easily. It's a program you can use on your computer that lets you talk to your toy box (or rather, your computer's files and folders) using special words called "commands."

With GitBash, you can tell your computer things like "Show me all the toys in my box" or "Put this toy in a special drawer so I can find it easily later." You can even ask it to remember what changes you make to your toys, so you can always go back to an earlier version if you want to.

Overall, GitBash is a very handy tool for organizing your computer's files and keeping track of changes you make to them, just like your toy box helps you keep your toys tidy and in good condition.