Urgent.News

What's breaking now, across thousands of outlets.

Tech

My First GitHub Project: From a Local Folder to GitHub Using Git and SSH

Before this week, "Git" and "GitHub" were basically the same word to me. Turns out they're not even close. Git is the thing that runs quietly on your own machine, tracking every change you make. GitHub is just where you choose to back that history up online. You can use Git your whole life and never touch GitHub. I didn't know that. Here's the moment it clicked: I had a messy .py file. Wednesday…

This week, I discovered the distinction between Git and GitHub. Git operates locally on your machine, meticulously recording each modification you make. Conversely, GitHub serves as a remote storage location for that history. You can utilize Git throughout your life and never interact with GitHub. The realization hit me when I had an untidy .py file that worked on Wednesday but failed by Thursday after fixing some visualizations.

Without Git, that project would be lost. However, with Git, each working version functions as a commit—a saved checkpoint that can be revisited at any time.

Initially, Git and GitHub appeared synonymous in my mind. Git is the persistent system that tracks every alteration made on your own computer. GitHub, on the other hand, is where you opt to back up that history online. It's possible to employ Git without ever engaging with GitHub. My epiphany occurred when I had a cluttered .py file that functioned initially but became unstable after some adjustments.

Without Git, that project would essentially vanish into thin air. Yet, with Git, each successful version serves as a commit—a checkpoint you can always revert to. That, in essence, encapsulates the entire magical process: transforming a folder into a repository. To initiate this journey, two commands sufficed: `git init`, and `git add .`.

The former instructs Git to observe the designated folder, while the latter stages what you wish to track. The subsequent step, `git commit -m "Initial project setup"`, locks in the changes as a checkpoint. It's a mundane yet strangely gratifying procedure.

SSH (Secure Shell) plays a role in authenticating your identity to GitHub, allowing you to push code without repeatedly entering a password. To generate SSH keys, you require a private key that remains on your laptop, and a public key that you provide to GitHub. The process involves executing `ssh-keygen -t ed25519 -C "your_email@example.com"`, accepting the default file location, and setting a passphrase.

Subsequently, the public key is added to your SSH agent to circumvent frequent prompts, and it's uploaded under your GitHub settings. Testing the configuration involves running `ssh -T git@github.com`, which yields a welcoming message upon successful authentication.

The core insight I gained wasn't the technical commands but rather the mental paradigm shift. Your computer houses the version history, while GitHub merely maintains a duplicate. Sending commits to GitHub via `git push` updates the remote repository, whereas retrieving changes with `git pull` updates your local copy. Once you grasp this fundamental concept, the remaining details become secondary.

For those embarking on this journey this week, my counsel is to refrain from hastily completing the SSH portion, as it's not merely a procedural hurdle to overcome. Instead, recognize its purpose: authenticating your identity to GitHub, not as a daunting task to navigate.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

More from Tuesday 25 August →