DEV Community

Elijah Karimi
Elijah Karimi

Posted on

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

Introduction

It is important to note that Git and GitHub are not the same thing and have different purposes. Git is a version control system that runs on my PC and helps track changes to files. GitHub on the other hand is an online platform where Git repositories can be stored, shared, and collaborated on. A Git repository is a storage space in a PC that contains project’s files along with the entire history of changes made to them. Therefore, Git as the tool used to manage the history of a project locally (on a PC), while GitHub provides a remote location where I can store and access that project.
This process requires Git the PC is linked to a GitHub account through SSH (Secure Shell), a cryptographic network protocol that enables secure remote access, command execution, and file transfers over unsecured networks.
This article is meant to explain how I created a project in a local folder, turned it into a Git repository, connected it to GitHub, configured SSH authentication, and pushed my work to the remote repository.

1. Starting With The Local Project

  1. Check File Location
    First, I needed to check my current location by running the command pwd. For that I got, /c/Users/ezraw, the folder that I was on currently.
    A directory is simply a folder. Your working directory is the folder your terminal is currently operating inside.

  2. Listing Files and Folders in the current location
    I ran the command, ls and got results of every folder in my working directory.

  3. Moving to Desktop
    My Desktop was my preferred location for the project on my PC. My Desktop was located in OneDrive therefore I ran cd OneDrive/. Thereafter, I ran cd Desktop to access my preferred location for the file I want to create.
    N/B: cd means Change Directory, and it's the command used to move into the folder one wants to access.

  4. Verify Location
    To verify if I was in my preferred folder, My Desktop, I ran pwdand got /c/Users/ezraw/OneDrive/Desktop thus confirming I was in the right location.

  5. Creating the Project Folder
    The project's name was kenyan-hospitals-health-records. I ran the following command mkdir kenyan-hospital-health-records.
    N/B: mkdir means Make Directory or Create New Folder
    To confirm the existence of the folder created I ran ls and got kenyan-hospitals-health-records as one of the files listed.

  6. Access the Folder
    To access my newly created folder for my project, I ran cd cd kenyan-hospital-health-records. To verify the file path and confirm folder's location, I ran pwd and got /c/Users/ezraw/OneDrive/Desktop/kenyan-hospitals-health-records as the result thus confirming my file path is as expected.

  7. Creating the Project's Structure
    To ensure order is established and avoid confusion or mistakes, I created folders within the main folder. I created three folders by running the following commands:
    mkdir data
    mkdir notebooks
    mkdir scripts
    Every project should have a brief description or overview in simple language, and therefore I created a README folder by running touch README.md.
    To confirm the sub-folders created for the project, I ran ls to get the list and got README.md data/ notebooks/ scripts/.
    N/B: The touch command is usually used to generate file folders that have extensions. The README.md sub-folder provides a synopsis of the project using the Markdown syntax. The data sub folder hosts files such as excel and csv files. The scripts sub-folder is meant to store scripts used for the project e.g. Python scripts usually marked as .py. The notebooks sub folder stores Jupyter Notebook scripts usually marked with .ipynb thus ensuring order.

  8. Adding the Existing Hospitals' Dataset to the Folders Created
    I already had the data I need for the project in an excel workbook sheet file, .xlxs file. I copied the file path from the downloads folder where it was located.
    I then ran cp command in the current terminal I was working in, which was, /c/Users/ezraw/OneDrive/Desktop/kenyan-hospitals-health-records. This is meant to copy the entire excel worksheet file onto the current folder I am working on.
    I ran cp ~/Downloads/Kenyan_Hospital_Health_Records.xlsx .and thereafter ran the ls to verify if the excel worksheet was rightly copied, and I got the result as Kenyan_Hospital_Health_Records.xlsx README.md data/ notebooks/ scripts/. This meant that the xlsx file which had the dataset was in the main project folder, and not in the data sub folder hence the need to move it to the data sub folder. I therefore ran mv Kenyan_Hospital_Health_Records.xlsx data/
    N/B:

    • cp means _copy. Copying a file path creates two or more files in the PC. Therefore, from my process I now have two xlsx files, one in Downloads and another similar file in the project's folder (that was moved into the Data sub-folder).
    • mv means move. Moving a file only changes the location of a file from the original location to the desired one. Upon running the command the result is README.md data/ notebooks/ scripts/ where if I run ls data, the result is Kenyan_Hospital_Health_Records.xlsx.
  9. Inspecting the Project
    This was done by simply running ls command to verify everything is in order. The data structure would look like,
    kenyan-hospital-health-records/

    ├── README.md

    ├── data/
    │ └── Kenyan_Hospital_Health_Records_Analysis.xlsx

    ├── notebooks/

    └── scripts/

  10. Add Content to README.md
    Like stated before, README.md is meant to provide brief overview about the project hence important to update it before I proceeded.
    I ran echo "# Kenyan Hospital Health Records Analysis" > README.md to provide a title and context to it. Thereafter, I added more information into different subsections.
    Markdown syntax is used to add the information required in the README.md section.
    N/B: Echo command means print text. > means
    write or replace.

  11. Review/Display The README.md contents
    I ran **cat README.md**and confirmed everything was in order.
    NOTE: Nano Text can be used to write, edit, add, remove text for longer README.md content. For this, I also ran nano README.md allowing longer text but it will be visible in the folder.
    I then checked the file graphically by using explorer to confirm the contents of the main project's folder along with sub folders. I had two READ.me files, the first one was short and second one a tad longer which I used Nano Text.

  12. Initialize the Project with Git
    It is always important to confirm the location one is in. Therefore, I ran pwd to confirm I am in the right terminal. Thereafter, I ran git init and got Initialized empty Git repository in C:/Users/ezraw/OneDrive/Desktop/kenyan-hospitals-health-records/.git/
    .

    git init command means the initialization of my project to a git repository; a storage space that contains your project’s files along with the entire history of changes made to them.

  13. Locating .git Hidden Folder
    Ran ls and then after ran a deeper search by running ls -la which resulted with some few additional files one of which included .git folder.
    .git folder contains Git's internal repository information. Git will use that. git folder to manage things such as: Commits, Branches, Repository configuration, Project history and References. That particular folder should not be manually deleted unless one wants to delete Git tracking and history from the project!

  14. Project Status
    I ran git status to check the current status of my project. The command meant to check the current activities in one's project.
    Part of my result read, Untracked files - a file that exists in a project, but tracking is yet to start.

    Upon running the command, I got the following results:

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        README.md
        README.md Kenyan Hospitals Data Record
        data/
Enter fullscreen mode Exit fullscreen mode

N/B: A modified file is a file Git already knows about but whose contents have changed since the
previous commit.

  - **_Changes to Be Committed_** - This means files have been staged and are ready for the next commit.
  - _**Working Tree Clean**_ - That means Git sees no new changes that need to be committed.
Enter fullscreen mode Exit fullscreen mode
  1. Transferring commits from the Local Repository to GitHub

From the start, I was working on a Working Directory called kenyan-hospitals-health-records, the title to my project's folder.
To prepare for changes selected in my project thus far for my next commit I ran git add and this point is called the Staging Area. A commit is a saved checkpoint in the history of a repository.
Staging Area - ran git add.
N/B: During the Working Directory and Staging Area phases the changes selected have not been uploaded to GitHub yet.

Thereafter I ran Git Status to check on the new files created and got:

[main (root-commit) c770225] add initial READMEs and Hospital dataset
 3 files changed, 32 insertions(+)
 create mode 100644 README.md
 create mode 100644 README.md Kenyan Hospitals Data Record
 create mode 100644 data/Kenyan_Hospital_Health_Records.xlsx
Enter fullscreen mode Exit fullscreen mode

Afterwards I ran git push along with a suitable title that follows the context of the project. This is important because it provides information on the sort of changes done for each saved checkpoint, commit.

  1. Commit History and Development Line

I ran 'git log' and 'git branch' to get the history line of development of the commit created.

$ git log
commit c77022507a8cd958b058455ef35c0e2dc8b3233b (HEAD -> main)
Author: Your Full Name <karimielijahmaina@gmail.com>
Date:   Sun Aug 23 07:06:09 2026 +0300

    add initial READMEs and Hospital dataset

ezraw@accessgranted MINGW64 ~/OneDrive/Desktop/kenyan-hospitals-health-records (main)
$ git branch
* main

ezraw@accessgranted MINGW64 ~/OneDrive/Desktop/kenyan-hospitals-health-records (main)
$ pwd
/c/Users/ezraw/OneDrive/Desktop/kenyan-hospitals-health-records
Enter fullscreen mode Exit fullscreen mode
  1. GitHub Repository

Now I needed to create a new GitHub repository for the project and hence the need to log into my account.
For the connections options I opted for the SSH which was the key used to connect my Git to my GitHub after a successful configuration. To confirm that, I ran$ ssh -T git@github.com and got:

$ ssh -T git@github.com
Enter passphrase for key '/c/Users/ezraw/.ssh/id_ed25519':
Hi MainaKarimi1925! You've successfully authenticated, but GitHub does not provide shell access.
Enter fullscreen mode Exit fullscreen mode
  1. Connecting Local Project to GitHub

I went back to GitBash/terminal. Confirmed my location of the project ( 'pwd' ).
I then ran git remote add origin git@github.com:USERNAME/kenyan-hospital-health-records.git, where the username was my GitHub's one. Remote - a repository account in connection with the local repository (main branch also called origin).

  1. Checking the Remote and Connecting the Project with Main Branch I ran 'git remote -v' to ensure Git can retrieve or fetch from the remote repository. The name of the origin file must be similar to the name in the url in one's taskbar to avoid errors. If an error occurs confirm if the Git and GitHub accounts are succesfully configured and/or check whether the title of the project in GitHub matches with the one on Git so that it can be located upon command. If the latter is the issue, as in my case, I ran the following commands:
ezraw@accessgranted MINGW64 ~/OneDrive/Desktop/kenyan-hospitals-health-records (main)
$ git remote set-url origin git@github.com:MainaKarimi1925/kenyan-hospitals-health-records-.git

ezraw@accessgranted MINGW64 ~/OneDrive/Desktop/kenyan-hospitals-health-records (main)
$ git push -u origin main
Enter passphrase for key 'C:\Users\ezraw/.ssh/id_ed25519':
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 115.65 KiB | 540.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (1/1), done.
To github.com:MainaKarimi1925/kenyan-hospitals-health-records-.git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.
Enter fullscreen mode Exit fullscreen mode
  1. Confirming

To confirm if the project has been added and linked to GitHub, I refreshed the remote repository page on the website.

Succesful connection of a Git repository to a GitHub account

2. Challenges Faced

Precision and Attention to Detail

  • Exact Syntax Matching: The biggest roadblock I faced today wasn't a conceptual misunderstanding, but a typographical one. For example, my GitHub URL ended in hospitals-health-records- but was initially typed as hospital-health-records. In technical writing and coding, systems are completely literal; a single missing letter or trailing hyphen will break the connection. More practice would help going forward.

  • Data Privacy Limitations and Risks with GitHub
    Data is sensitive nowadays and each platform has strict rules. The remedy is to verify and be careful of what I share publicly going forward.

3. Conclusion

The Git workflow is based on a simple but powerful and strict sequence: working directory, staging area, commit, and push.
The most important lesson is that these commands perform different jobs. git add prepares changes, git commit records them locally, and git push transfers those commits to the remote repository.

Once this workflow is understood, Git becomes much less confusing. Instead of memorizing commands individually, I can see them as steps in a logical process:

WORK → STAGE → COMMIT → PUSH

This workflow provides a reliable way to track project changes, maintain a history of development, and safely share work through a remote repository.

Also, Technical Writing is fun and interesting. It actually enhances one's knowledge in the area of interest, as it was with me during this session.

Top comments (0)