<?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: Njoroge Peter</title>
    <description>The latest articles on DEV Community by Njoroge Peter (@njoroge_peter_5f72998620f).</description>
    <link>https://dev.to/njoroge_peter_5f72998620f</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%2F3951186%2F05bb8bb1-1338-4b5f-9dfe-dff3f0f4bddd.png</url>
      <title>DEV Community: Njoroge Peter</title>
      <link>https://dev.to/njoroge_peter_5f72998620f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/njoroge_peter_5f72998620f"/>
    <language>en</language>
    <item>
      <title>From Local Folder to Github: Setting Up my First Project With Git and Github: A Guide</title>
      <dc:creator>Njoroge Peter</dc:creator>
      <pubDate>Sun, 23 Aug 2026 15:28:04 +0000</pubDate>
      <link>https://dev.to/njoroge_peter_5f72998620f/from-local-folder-to-github-setting-up-my-first-project-with-git-and-github-a-guide-4lpb</link>
      <guid>https://dev.to/njoroge_peter_5f72998620f/from-local-folder-to-github-setting-up-my-first-project-with-git-and-github-a-guide-4lpb</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Managing files locally or manually in your own pc gets out of hand very fast. You might find that you have a file named project_final_1 and project_final_2 which are about the same project but named differently depending on the day the projects were updated or modified. &lt;br&gt;
Git Bash is a command line tool that records detailed history of your code as it changes over time&lt;br&gt;
GitHub is an online tool where the changes in your code are stored remotely. GitHub does not use folders instead it uses repositories. The repositories make it easier for you to store your work, have a back-up of your work and also showcase your portfolio. &lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1:Installing Git&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;First you have to install git depending on your operating system. &lt;br&gt;
Once installed open git bash and you have to tell Git who you are. The code below will help you set up git for the very first time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"put your name here"&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"put your email here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After configuration you have to verify your installation with the code below&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;h2&gt;
  
  
  &lt;strong&gt;Adding SSH Key&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For your git to be connected to git hub you have to genarate an ssh key. The key allows your git to access your github without much stress. First you open your terminal or git bash terminal and run the code below to generate the 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;"enter your email here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code will prompt you on your terminal to save the key on its default location, press enter.&lt;br&gt;
Next you will be prompted to enter a passphrase, for easy access and to elimate the chances of forgetting the passphrase you entered just press enter twice.&lt;/p&gt;

&lt;p&gt;Now you have a public key saved in your pc, use the command below to copy the key.&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;h2&gt;
  
  
  &lt;strong&gt;Adding the Key to GitHub&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Login into github, click on your profile picture in the top left corner and select &lt;em&gt;&lt;strong&gt;settings&lt;/strong&gt;&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;in the left navigation bar click &lt;strong&gt;&lt;em&gt;SSH and GPG keys&lt;/em&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;&lt;em&gt;New SSH key&lt;/em&gt;&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;Give a description of your key (eg .my work laptop), in the drop down menu make sure your &lt;strong&gt;&lt;em&gt;key type is aunthentication key&lt;/em&gt;&lt;/strong&gt; and paste your public key into the key field.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;em&gt;Add SSH key&lt;/em&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Test the SSH Connection&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you have completed all the above steps above the next step should be to verify your coonection has been successful. To test the connection run the code below;&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;After running the command above you should a get a message in your terminal&lt;br&gt;
 &lt;em&gt;Hi you have successfully auntheticated, but Github does not provide shell access&lt;/em&gt; &lt;br&gt;
If you have gotten this message you have successfully connected your git and github.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:Making the first commit&lt;/strong&gt;&lt;br&gt;
Create the project folder and navigate to it using the code below&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;Kenya-health-records-analysis
&lt;span class="nb"&gt;cd &lt;/span&gt;Kenya-health-records-analysis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now that you are in the working folder now add a README.md file and a data file&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;data
&lt;span class="nb"&gt;touch &lt;/span&gt;README.md 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;from here i proceed to copy the Kenya_Health_Records.csv dataset and pasted it into data.To confirm that i have correctly copied i run the command below in gitbash&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;ls &lt;/span&gt;data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I the described the project in the README.md file. For this i used the echo command&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;echo&lt;/span&gt; &lt;span class="s2"&gt;"# An analysis of Kenya health records"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then i initialized git so that it can track the changes i do in the 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 init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now git will track all the changes made to each file.&lt;br&gt;
From here we check how git is tracking my 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 status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the command above shows the README.md and datafolder in red. This means git notices these files exist in my working directory but they haven't been staged yet. So that stage the files so we can commit them we need to run the command below&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;the dot after add means that git is staging all the files.If now you type git status you will see the files turn green under changes to be committed.&lt;/p&gt;

&lt;p&gt;At this stage i was ready to commit the changes and i run the command below&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;the -m shows i want to put a message describing what changes were made.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Connecting to Github&lt;/strong&gt;&lt;br&gt;
This step ensures that the changes commited can be saved on a repository on Github&lt;br&gt;
the process is quite simple;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;log into github click the &lt;strong&gt;+&lt;/strong&gt; icon on the  top right corner and select &lt;strong&gt;New Repository&lt;/strong&gt; here i created a repository called Kenya-health-records-analysis.&lt;/li&gt;
&lt;li&gt;I made my repository public. It is important not to check any other boxes.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Repository&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On the repository setup page select the ssh tab and copy the url.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Back now in git bash I used the url i copied suing the command below&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:PNjoroge-DataEng/Kenya-health-records-analysis.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Pushing code to GitHub&lt;/strong&gt;&lt;br&gt;
Once i established connection to Github all i needed was to upload to github.To do i used the command below&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;The -u flag links the local main branch to the main branch on github.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary **&lt;br&gt;
Setiing up version control was hectict at first but i managed to set it up perfectly.After setting it up i have used these commands more frequently;&lt;br&gt;
**git init&lt;/strong&gt;  -to initialize git in my working folder&lt;br&gt;
&lt;strong&gt;git status&lt;/strong&gt;  -to check which files are modified &lt;br&gt;
&lt;strong&gt;git add&lt;/strong&gt;  -to stage changes to be committed&lt;br&gt;
&lt;strong&gt;git commit -m "message"&lt;/strong&gt;  -to save the changes made&lt;br&gt;
&lt;strong&gt;git push&lt;/strong&gt;  -to upload the commit to Github&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; git init should be run once you are in the working directory.&lt;/p&gt;

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