DEV Community

Timothy M Kariuki
Timothy M Kariuki

Posted on

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

Introduction

Walking into a new space of learning or career means you will hear vocabularies you haven't heard before. Well, when I joined the data Analytics class I didn't know Git and GitHub and perhaps one might think that Git is the short form for GitHub. Git is a powerful distributed version control system used by developers and coders to track and manage code changes locally with features like branching and merging while web-based platform that hosts Git repositories and enables collaboration through pull requests, issues and team management. Git operates mainly via command-line interface (CLI) with optional GUI tools while GitHub provides a web-based UI plus integrations along with Git command support.

Installations, Configurations and Signup to the Environments

I started by downloading and setting up the Gitbash terminal on my computer. After successful set up I typed cd Desktop command to go to my desktop folder. then used ls command to list the items on my desktop folder. Next, I created a folder and named it Kenya-Hospital-Records-Analysis using the mkdir Kenya-Hospital-Records-Analysis command then used the cd My-First-Github-Project to move into the folder. I created another folder called data using mkdir Data and a README file using touch README.md command.

Creating a GitHub Repository

Since I had already created a GitHub account so I tapped the add button and created a new repository named Kenya-Hospital-Records-Analysis. I create an SSH authentication key used when pushing project from the computer to the Github Repository. I achieve this by running the ssh-keygen-t ed25519 -c command and copied the key to GitHub, authenticated and tested the connection.

Uploading the Project to Github

The Git initialization process involved the following steps:

  • To test whether my computer could successfully authenticate with GitHub using SSH I run the $ ssh -T git@github.com command. and used the cd Desktop command

  • I initialized the git repository inside the folder using the: git init command.

  • After initialization I run the git add . to prepare the files in the Kenya-Hospital-Records-Analysis directory for upload and then run the git commit -m command.

Then comes the steps to link the local folder to the repository

  • The next step involved logging in to the github repository created a new repository to load the project.
  • I then copied the SSH key from github and used it to link the local folder to github as shown: git remote add origin git@github.com:Timothy*****/Kenya-Hospital-Records-Analysis

  • And finally to push the project to the repository I used the command: git push -u origin main.

With those steps above the project was uploaded to the github repository and could be viewed by the public.

Conclusion

In this exercise, I went through the complete process of taking a project from a local folder on my computer and publishing it to GitHub using Git and SSH. I started by creating a local project, initializing it as a Git repository, tracking our files, and creating our first commit. Understanding this workflow provides a strong foundation for working with Git and GitHub and I believe that continued practice will give me the confidence and skills to partake more complex tasks

Top comments (0)