My First GitHub Project: From A Local Folder To GitHub Using Git And SSH
Introduction. I have folder with files sitting quietly on my laptop, and the idea of turning it into a "real project" on github feels like a mountain. This week, i climbed that mountain and i want to walk you through exactly how i did. Git vs GitHub. Git is a tool that lives on my computer and its the thing that actually tracks the changes i make to my files GitHub is a website. Its where i can…
My first GitHub project began with a simple folder containing files on my laptop. Converting that folder into a real GitHub project felt like scaling a mountain. In this account, I will walk through the process of turning the local folder into a GitHub project, using Git and SSH.
Git and GitHub serve different purposes. Git is a tool residing on my computer, responsible for tracking changes in my files. GitHub, on the other hand, is a website where I can store an online copy of the files, enabling me to share, back up, or work on them from a different computer. Git handles the tracking, while GitHub takes care of hosting.
To create a Git project, I first established a folder named "my-first-project" within Git Bash, a command-line tool for interacting with Git and performing common computer tasks using commands. I utilized Git Bash commands to view files and folders, create a new folder, and navigate through directories.
To make Git recognize the "my-first-project" folder, I opened the terminal, navigated into the folder, and executed the appropriate commands. This initial step transformed my local folder into a Git project.
The next crucial step was setting up SSH to enable GitHub to trust my computer. SSH keys function like digital handshakes, allowing my computer and GitHub to recognize each other without requiring me to input a password with every interaction. To set up the SSH key, I generated a key using the command-line command "ssh-keygen -T ed25519 -C 'my email'" in Git Bash.
This command created two files: a private key and a public key. The public key was then copied using the "cat" command and added to my GitHub account. Finally, I tested the connection by running the command "ssh -T git@github.com" in Git Bash, which prompted a warning about connecting to a new host, and I confirmed the connection by typing "yes".
With SSH set up, the final step involved connecting my local folder to the GitHub repository. I named the repository the same as my local folder, creating a nickname called "origin" for the GitHub repository, so I wouldn't have to type the full URL every time. Following this, I learned about the Git workflow, which includes staging, committing, and pushing.
Staging refers to the waiting room where I select which changes to include in the next save point. A commit is the actual save point in the project's history, and the commit message should describe the changes made. Finally, pushing transfers the local commit to GitHub.
Upon completing this process, I learned that it's essential not to overlook the SSH setup, even though it may seem intimidating at first. The SSH setup turned out to be enjoyable and facilitated a smooth transition into my first GitHub project.
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.