<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel Koech</title>
    <description>The latest articles on DEV Community by Emmanuel Koech (@emmanuel687).</description>
    <link>https://dev.to/emmanuel687</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F812285%2F00c4ebed-fbb2-4e0b-83d8-3767cee932ac.png</url>
      <title>DEV Community: Emmanuel Koech</title>
      <link>https://dev.to/emmanuel687</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emmanuel687"/>
    <language>en</language>
    <item>
      <title>Understanding the Git Workflow: Working Directory, Staging, Commit and Push.</title>
      <dc:creator>Emmanuel Koech</dc:creator>
      <pubDate>Fri, 21 Aug 2026 16:17:36 +0000</pubDate>
      <link>https://dev.to/emmanuel687/understanding-the-git-workflow-working-directory-staging-commit-and-push-j8f</link>
      <guid>https://dev.to/emmanuel687/understanding-the-git-workflow-working-directory-staging-commit-and-push-j8f</guid>
      <description>&lt;h1&gt;
  
  
  My First GitHub Project: From a Local Folder to GitHub Using Git and SSH
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When I started learning Git, I found it a bit confusing at first. I knew GitHub was used to store code, but I did not fully understand how a project on my computer gets connected to GitHub.&lt;/p&gt;

&lt;p&gt;In this article, I will explain the steps I followed to create a simple project, connect it to GitHub using SSH, and push my code to the repository.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;Git is a tool that helps developers track changes in their code.&lt;/p&gt;

&lt;p&gt;For example, if I am working on a website and make changes to my files, Git keeps a record of those changes. This makes it easier to go back to an earlier version if something goes wrong.&lt;/p&gt;

&lt;p&gt;Git works on your computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is GitHub?
&lt;/h2&gt;

&lt;p&gt;GitHub is a website where Git repositories can be stored online.&lt;/p&gt;

&lt;p&gt;The easiest way to understand the difference is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt; helps me track my code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt; stores my code online.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub also makes it easier for developers to share projects and work together.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Install Git
&lt;/h2&gt;

&lt;p&gt;The first thing I need is Git installed on my computer.&lt;/p&gt;

&lt;p&gt;I can check if Git is installed by opening the terminal and running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Git is installed, I should get something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git version 2.x.x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The version number may be different depending on the computer.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Create a Project Folder
&lt;/h2&gt;

&lt;p&gt;I can create a folder for my project.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;my-first-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I move into the folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;my-first-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can then create a simple file such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the file, I can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# My First GitHub Project

This is my first project using Git and GitHub.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, the project is only on my computer.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Initialize Git
&lt;/h2&gt;

&lt;p&gt;Now I need to tell Git that this folder is a Git project.&lt;/p&gt;

&lt;p&gt;I run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a hidden &lt;code&gt;.git&lt;/code&gt; folder inside my project.&lt;/p&gt;

&lt;p&gt;I can check the status of the project with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git will show me which files are currently being tracked or are not yet tracked.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Set Up SSH
&lt;/h2&gt;

&lt;p&gt;SSH allows my computer to connect securely to GitHub.&lt;/p&gt;

&lt;p&gt;First, I create an SSH key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"your-email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can press Enter to use the default location.&lt;/p&gt;

&lt;p&gt;This creates two keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id_ed25519
id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important thing to remember is that the &lt;code&gt;.pub&lt;/code&gt; file is the public key.&lt;/p&gt;

&lt;p&gt;I should &lt;strong&gt;never share my private key&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Add the SSH Key to GitHub
&lt;/h2&gt;

&lt;p&gt;I need to copy my public key and add it to my GitHub account.&lt;/p&gt;

&lt;p&gt;On Linux or macOS, I can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Get-Content&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;~/.ssh/id_ed25519.pub&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I copy the key that is displayed.&lt;/p&gt;

&lt;p&gt;Then on GitHub, I go to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Settings → SSH and GPG keys → New SSH key&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I give the key a name, paste my public key, and save it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6: Test the SSH Connection
&lt;/h2&gt;

&lt;p&gt;Before pushing my project, I can test whether SSH is working:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is set up correctly, GitHub will confirm that authentication was successful.&lt;/p&gt;

&lt;p&gt;This means my computer can communicate with GitHub using SSH.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 7: Create a Repository on GitHub
&lt;/h2&gt;

&lt;p&gt;Next, I create a new repository on GitHub.&lt;/p&gt;

&lt;p&gt;For example, I can name it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-first-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I create the repository without adding a README because I already have one in my local project.&lt;/p&gt;

&lt;p&gt;GitHub will then give me a repository address that looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git@github.com:username/my-first-project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 8: Connect My Local Project to GitHub
&lt;/h2&gt;

&lt;p&gt;I go back to my terminal and make sure I am inside my project folder.&lt;/p&gt;

&lt;p&gt;Then I connect it to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin git@github.com:username/my-first-project.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;origin&lt;/code&gt; is the name Git gives to the remote repository.&lt;/p&gt;

&lt;p&gt;I can check that the connection was added by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 9: Add My Files
&lt;/h2&gt;

&lt;p&gt;Before committing my files, I need to add them to the staging area.&lt;/p&gt;

&lt;p&gt;I can add a specific file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or I can add all the files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can check the status again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 10: Commit the Changes
&lt;/h2&gt;

&lt;p&gt;Now I create my first commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A commit is basically a saved version of my changes.&lt;/p&gt;

&lt;p&gt;The message should explain what I changed.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add README"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 11: Push the Project to GitHub
&lt;/h2&gt;

&lt;p&gt;Before pushing, I can make sure my branch is called &lt;code&gt;main&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I push the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git will send my committed files to the GitHub repository.&lt;/p&gt;

&lt;p&gt;I can then refresh my GitHub repository page and see my project online.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Git Workflow
&lt;/h2&gt;

&lt;p&gt;After setting everything up, the normal process becomes much simpler.&lt;/p&gt;

&lt;p&gt;Whenever I make changes to my project, I can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Describe my changes"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the basic workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Make changes
     ↓
git add
     ↓
git commit
     ↓
git push
     ↓
GitHub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Common Problems
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Permission denied (publickey)
&lt;/h3&gt;

&lt;p&gt;If I get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Permission denied (publickey)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it usually means GitHub could not authenticate my SSH key.&lt;/p&gt;

&lt;p&gt;I should check that I added the correct public key to GitHub.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nothing to commit
&lt;/h3&gt;

&lt;p&gt;If Git says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nothing to commit, working tree clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it means there are no new changes to commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrong repository
&lt;/h3&gt;

&lt;p&gt;If I connected my project to the wrong GitHub repository, I can check the remote using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can also change it using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote set-url origin git@github.com:username/repository.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using Git and GitHub becomes much easier once I understand the basic process.&lt;/p&gt;

&lt;p&gt;I create my project locally, initialize Git, connect my GitHub account using SSH, create a repository, commit my changes, and push them to GitHub.&lt;/p&gt;

&lt;p&gt;The main commands I need to remember are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git status
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"message"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I learned that Git is used to manage changes in my project, while GitHub allows me to store and share that project online. SSH makes the connection between my computer and GitHub secure.&lt;/p&gt;

&lt;p&gt;This is the basic workflow I can now use for future projects.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>github</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
