Introduction
Work that exists in one place is work you can lose. Git records the history of a project as you continue building it, and GitHub is the server where you keep a copy of the project online, and SSH is what you use to make the exchange securely. In this article is my account of connecting all three for the first time.
Git, Github, and SSH
Git is a program that tracks changes inside a project folder. GitHub is a website that holds a copy of your repository, so it's a backup, and also it can be shared. In this copying of your project content to Github from your local machine, delivery can be a problem. In an example of sending a letter to someone, the post office must confirm you are who you claim to be, and the letter shouldn't be readable in transit. SSH (Secure Shell) does both. Your private key is the ID you possess, and the public key is what GitHub keeps to itself to check against.
Creating your SSH key
Open your Git Bash terminal and put in these commands.
ssh-keygen -t ed25519 -C "your_email@example.com"
In this section it's where you will set your paraphrase.
cat ~/.ssh/id_ed25519.pub
This outputs where your public key is and is what you will paste in the GitHub account's Profile/Settings/SSH and GPG keys.
ssh -T git@github.com
This command confirms you have set your key correctly in your GitHub account.
Preparing the Address
Here you create an empty repository on GitHub because I would need an address to deliver the letter.
Commands to run locally in your Git Bash
mkdir folderName
cd folderName
touch README.md
git init
git add .
git status
git commit -m "message"
Addressing and Sending
git branch -M main
git remote add origin git@github.com:user/repo.git
git push -u origin main
Challenges and what went wrong
- Forgot my paraphrase, and I had to make a new SSH key and readd it
- Ran into a problem using the Nano and Vim editor when it came to saving and exiting
Conclusion
Git helped me solve the problem of recording every change I made, and GitHub hosted a copy of my project's content, and SSH helped me connect them securely without typing passwords every time
Top comments (0)