DEV Community

moses odhiambo
moses odhiambo

Posted on

Don't Be Afraid of Git: A Beginner's Guide to Saving and Sharing

#Don't Be Afraid of Git

When I first heard about Git, I thought it was something only senior developers could use.

Turns out, Git is actually very simple. We just make it sound complicated.

This article explains Git in the easiest way possible.

No big words. No stress. Just what Git does and how you can use it.

##What is Git?

Git is a tool that remembers your code.

Every time you change something, Git can:

  • Save it
  • Remember what changed
  • Let you go back if you make a mistake

If you’ve ever renamed files like:

final.js → final-final.js → final-final-please-work.js 
Enter fullscreen mode Exit fullscreen mode

…then Git is exactly what you need.

###What Is Version Control?
Version control just means keeping a history of your work.

Think of it like WhatsApp:

  • You can scroll back and see old messages
  • You know what was sent
  • You can restore something if needed

Git does the same thing, but for code.

If your project breaks today, you can go back to yesterday when it worked.

####Git vs GitHub

This confused me at first too.

  • Git lives on your computer
  • GitHub lives on the internet

Git is the tool.

GitHub is where you store your projects online.

Think of it like this:

  • Git = your notebook at home
  • GitHub = cloud storage for your notebook

*#####Starting a Git Project*

You don’t need anything fancy.

All you need:

  • A folder
  • Some files
  • Some code

Inside that folder, run:

git --version
Enter fullscreen mode Exit fullscreen mode

Hold on, yes let take a minute, before Before we jump right onto it, let’s make sure Git is already installed on your computer.

Alright once you have installed Git in your Machine, proceed by opening Git once its open run this:

git --version

"If" and yes I have said "if" Git is installed, you’ll see something like:

git version 2.52.0.windows.1
Enter fullscreen mode Exit fullscreen mode

That means Git is ready to use.

If you see an error or nothing shows up, it just means Git is not installed yet.

You can install it and then come back to this guide.
This small step helps avoid confusion later.

######Configure Git (Tell Git Who You Are)

Before Git starts saving your work, it wants to know your name and email.
please don't be scared.
Git just wants to label your saved changes so it knows who made them.

Step 1: Set Your Name

git config --global user.name "Your Name"
Enter fullscreen mode Exit fullscreen mode

Example:

git config --global user.name "Moses Odhiambo"
Enter fullscreen mode Exit fullscreen mode

Step 2: Set Your Email

 git config --global user.name "your email@example.com"
Enter fullscreen mode Exit fullscreen mode

Please note that you must use the same e mail you use on GitHub.

For your information:

What Does This Do?

This does not:

  • Create an account
  • Send emails
  • Share your private info

It simply helps Git say: “This change was made by Moses.”

Every time you commit code, Git uses this information.

#######Check Your Configuration

So now here basically helps us check that every details is set correctly , to confirm this run:

git config --list
Enter fullscreen mode Exit fullscreen mode

Now after running it you are supposed to see your name and email in the list, like as follows:

 git config --list
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=schannel
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
core.editor="C:\Users\Hp\AppData\Local\Programs\Microsoft VS Code\bin\code" --wa
it
user.name=odhiambomoses67@gmail.com
user.email=odhiambomoses67@gmail.com
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
:
Enter fullscreen mode Exit fullscreen mode

Why This Step Matters

If you skip this step:

  • Git may refuse to save your work
  • Or it may save commits without your name

Configuring Git once saves you trouble later.
You only need to do this one time.

Why Do We Use --global?
Yes just like you, I asked myself why do we need to use --global?.

well when you see this command:

git config --global user.name "Your Name"
Enter fullscreen mode Exit fullscreen mode

The word --global just means: “Use this name and email for all my Git projects on this computer.” Imagine just like.

What Happens When You Use --global

  • Git remembers your name once
  • Git remembers your email once
  • Every project you create will use this information
  • You don’t have to repeat it for every new folder or project.

What If You Don’t Use --global?

If you remove --global, Git will:

  • Ask you to set your name and email again
  • Do it for each project separately
  • That’s extra work, especially when you’re just starting out.
  • When Would You Not Use --global?

Sometimes people:

  • Use different emails for work and personal projects
  • Contribute to company projects
  • In that case, they may set the name and email only for that project.
  • But for beginners?
  • Always use --global.
  • It keeps things simple.
  • Simple Way to Remember
  • --global = everywhere on this computer
  • No --global = only this one project

########What Is a Git Agent? (SSH Agent )

You thought An agent is the one from your M-pesa, bank Or that Friend of yours who sales land, then your wrong.
let me tell you something maina, An Agent is just a helper period.

In Git, the most common one is the SSH agent.

Think of the SSH agent like this:

“A trusted guard that remembers your key so GitHub knows it’s really you.”

Why Do We Need an Agent?

When you push code to GitHub, GitHub wants to be sure: It’s really you not someone else pretending.

The SSH agent helps by:

  • Holding your SSH key in memory
  • Letting Git talk to GitHub securely
  • Preventing you from typing passwords every time

What the SSH Agent Actually Does

Once it’s running:

  • Git uses it automatically
  • You don’t see it working
  • You don’t interact with it every time
  • It just quietly helps in the background.

Do Beginners Need to Worry About This?

  • Not much and that’s okay.

If you:

  • Installed Git normally
  • Use GitHub
  • Push and pull code successfully
  • Then the agent is already doing its job.
  • Most beginners don’t notice it until:
  • They set up SSH keys
  • Or Git asks for authentication

Simple Way to Think About It

  • Git → saves your code
  • GitHub → stores it online
  • SSH Agent → proves you are allowed to send it

Bottom Line

  • You don’t need to master agents to use Git.
  • Just know this: The agent is a helper that keeps Git and GitHub talking safely.

########GitHub Settings for Beginners

So now, before you can push code online, you need to set up GitHub and connect it to your computer. Clam down it’s easier than it sounds, allow me your captain to take you through, kindly fasten your fasten belt.

Step 1: Create a GitHub Account

  • Go to GitHub.com
  • Click Sign Up
  • Enter your username, email, and password
  • Verify your email

N/B : Use the same email you configured in Git (git config --global user.email).

Step 2: Create a New Repository

  • Click the + icon in the top-right corner → New Repository
  • Name your repository (e.g., my-first-git-project)
  • Choose Public or Private
  • Don’t check Initialize with a README if you already have a local project
  • Click Create Repository
  • This will give you the URL to connect your local project.

Step 3: Set Up SSH (Optional but Recommended)

SSH helps you connect your computer to GitHub securely without typing your password every time.

  • Open your terminal

  • Check for existing SSH keys:

ls -al ~/.ssh
Enter fullscreen mode Exit fullscreen mode
  • If no key exists, create one:
ssh-keygen -t ed25519 -C "youremail@example.com"
Enter fullscreen mode Exit fullscreen mode
  • Press Enter to accept defaults.

  • Start the SSH agent:

eval "$(ssh-agent -s)"
Enter fullscreen mode Exit fullscreen mode
  • Add your SSH key to the agent:
ssh-add ~/.ssh/id_ed25519


- *Copy the key to GitHub:*

Enter fullscreen mode Exit fullscreen mode

cat ~/.ssh/id_ed25519.pub

*Paste it in GitHub → Settings → SSH and GPG keys → New SSH key*


***Step 4: Link Your Local Project to GitHub***

*- In your project folder:*

Enter fullscreen mode Exit fullscreen mode

git remote add origin git@github.com:username/repo.git

*Replace username and repo with your GitHub username and repository name.*

***Step 5: Push Your First Commit***

Enter fullscreen mode Exit fullscreen mode

git push -u origin main


*Now your local project is online on GitHub, ready to share or collaborate.*

**#########Installing PostgreSQL on Windows (Step by Step)**

*Step 1: Go to the PostgreSQL website*

- Open your browser and go to:
- https://www.postgresql.org
- On the homepage:
- Click Download
- Choose Windows
Screenshot here: PostgreSQL homepage with “Download” highlighted

***Step 2: Download the installer***

- Click Download the installer
- You’ll be redirected to EnterpriseDB
- Download the latest version (recommended)

*The file will look like:*

Enter fullscreen mode Exit fullscreen mode

postgresql-16.x-windows-x64.exe

Screenshot here: Download page showing Windows installer

***Step 3: Run the installer***

- Double-click the downloaded .exe file
- Click Yes if Windows asks for permission
- You’ll see the PostgreSQL Setup Wizard.

 Screenshot here: PostgreSQL Setup Wizard welcome screen

***Step 4: Choose installation directory***

- Click Next to keep the default path:


Enter fullscreen mode Exit fullscreen mode

C:\Program Files\PostgreSQL\16


- Beginners should not change this.

 Screenshot here: Installation directory screen

***Step 5: Select components to install***

*Make sure ALL are checked:*

-  PostgreSQL Server
-  pgAdmin 4
-  Stack Builder
-  Command Line Tools

- Click Next

 Screenshot here: Components checklist

***Step 6: Set database data directory***

- Leave it as default:

Enter fullscreen mode Exit fullscreen mode

C:\Program Files\PostgreSQL\16\data


- Click Next.

 Screenshot here: Data directory screen

***Step 7: Set the PostgreSQL password (VERY IMPORTANT)***

- This password is for the postgres admin user.
- Choose a password you will remember
- Do NOT leave it blank
- Example:

Enter fullscreen mode Exit fullscreen mode

postgres123


- Click Next.
Screenshot here: Password setup screen


***Step 8: Choose the port number***

- Leave it as default:

Enter fullscreen mode Exit fullscreen mode

5432


- This is the standard PostgreSQL port.
- Click Next.

 Screenshot here: Port configuration screen

*Step 9: Locale settings*

- Leave it as:

Enter fullscreen mode Exit fullscreen mode

Default locale


- Click Next.

Screenshot here: Locale selection screen


***Step 10: Start installation***

- Click Next → Install
- Wait for installation to complete (2–5 minutes).

Screenshot here: Installation progress bar

***Step 11: Finish installation***

Uncheck Stack Builder (optional)

- Click Finish
- PostgreSQL is now installed 

Screenshot here: Installation complete screen


***Step 12: Confirm PostgreSQL is working***

- Option 1: Using pgAdmin
- Open pgAdmin 4
- Enter the password you created
- Expand Servers → PostgreSQL

 Screenshot here: pgAdmin dashboard


- Option 2: Using Command Line
- Open Command Prompt and run:

Enter fullscreen mode Exit fullscreen mode

psql --version


- You should see something like:


Enter fullscreen mode Exit fullscreen mode

psql (PostgreSQL) 16.1



- This confirms PostgreSQL is installed correctly.



**##########Connecting PostgreSQL to DBeaver (Step by Step)**

So now this part explains how to see and work with your PostgreSQL database visually using DBeaver.

***What is DBeaver?***

*DBeaver is a window you use to:*

- See your databases
- See tables and data
- Write SQL without fear
- PostgreSQL is the brain
- DBeaver is the face you talk to.

***Step 1: Download and install DBeaver***

- Go to: https://dbeaver.io
- Click Download
- Choose DBeaver Community (Free)
- Download the Windows installer
- Install using Next → Next → Finish

 Screenshot here: DBeaver download page

***Step 2: Open DBeaver***

- Launch DBeaver
- You’ll see a welcome screen or empty workspace

 Screenshot here: DBeaver home screen

***Step 3: Create a new database connection***

- Click New Database Connection (or the plug 🔌 icon)

Screenshot here: “New Database Connection” button highlighted

***Step 4: Select PostgreSQL***

- From the list, choose PostgreSQL
- Click Next

Screenshot here: PostgreSQL selected from database list

*Step 5: Enter PostgreSQL connection details*

*Fill the fields like this:*


| **Field**  | **Value**
|------------|-----------
|Host        | localhost
|Port        | 5432
|Database    | postgres
|Username    | postgres
|Password    |(the password you set during installation)

 Screenshot here: Connection settings filled in

***Step 6: Download PostgreSQL driver***

*The first time:*

- DBeaver will ask to download the PostgreSQL driver
- Click Download

 Screenshot here: Driver download popup


***Step 7: Test the connection***

- Click Test Connection
- If successful, click Finish
- If it fails:
- Check password
- Ensure PostgreSQL service is running

 Screenshot here: “Connected successfully” message


*Step 8: Explore your PostgreSQL database*

*On the left panel:*

Enter fullscreen mode Exit fullscreen mode

Servers
└── PostgreSQL
└── Databases
└── postgres


- You can now:
- View schemas
- Create tables
- Run SQL queries

 Screenshot here: Database tree expanded

***Step 9: Run your first SQL query***

- Right-click the database
- Click SQL Editor → New SQL Script
- Type:

Enter fullscreen mode Exit fullscreen mode

SELECT version();


- Click Run ▶

- You’ll see PostgreSQL version details.

Screenshot here: SQL editor with query results

**What just happened **

- PostgreSQL is running in the background
- DBeaver connects to it using credentials
- You are now talking to the database safely


***How this fits with Git & GitHub***

- Best practice:
- SQL files are saved in a project folder
- That folder is tracked by Git
- Changes are pushed to GitHub
- Example:


Enter fullscreen mode Exit fullscreen mode

project/
├── sql/
│ └── create_tables.sql
├── README.md
└── .git/


**###########Using PostgreSQL with Visual Studio Code (VS Code)**

This part shows how VS Code helps you write SQL, manage files, and work with Git all in one place.


***What is VS Code***

Visual Studio Code is like a smart notebook for developers.

*You can:*

- Write SQL
- Write Python
- Track changes with Git
- Open your whole project in one window
- PostgreSQL stores data
- VS Code stores your work files

***Step 1: Install Visual Studio Code***

- Go to:https://code.visualstudio.com
- Click Download for Windows
- Install using default settings

 Screenshot here: VS Code download page

***Step 2: Open your project folder***

- Create a folder on your PC:

Enter fullscreen mode Exit fullscreen mode

postgres-project


- Open VS Code
- Click File → Open Folder
- Select postgres-project

 Screenshot here: Open folder in VS Code


***Step 3: Create SQL files***

- Inside VS Code:
- Right-click → New File
- Name it:

Enter fullscreen mode Exit fullscreen mode

create_tables.sql

*Add this code:*

Enter fullscreen mode Exit fullscreen mode

CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT,
email TEXT
);


Screenshot here: SQL file opened in VS Code


***Step 4: Install PostgreSQL extension in VS Code*
**

- Click Extensions (left sidebar)
- Search: PostgreSQL
- Install PostgreSQL by Chris Kolkman or SQLTools

 Screenshot here: PostgreSQL extension installed


***Step 5: Connect PostgreSQL inside VS Code***

- Using SQLTools:
- Open Command Palette (Ctrl + Shift + P)
- Select SQLTools: Add New Connection
- Choose PostgreSQL
- Enter:
- Server: localhost
- Port: 5432
- Database: my_app_db
- Username: my_user
- Password: your password

Screenshot here: PostgreSQL connection setup in VS Code


***Step 6: Run SQL from VS Code***

- Open your .sql file
- Select the SQL
- Right-click → Run Query
- Results appear in the output panel.
- You’re now using PostgreSQL from VS Code.

_*Why developers love this setup*_

- SQL files are saved
- Git tracks changes
- You can undo mistakes
- Everything is organized

*How Git fits here*

Your project folder now looks like this:

Enter fullscreen mode Exit fullscreen mode

postgres-project/
├── sql/
│ └── create_tables.sql
├── README.md
└── .git/


_Each change you make:_

Enter fullscreen mode Exit fullscreen mode

git add .
git commit -m "Create users table"
git push

**_Beginner mistake to avoid_**

-  Writing SQL only inside DBeaver
-  Always save SQL files in VS Code and commit them

**Using PostgreSQL with Python**

_**What Python does here**_

Python talks to PostgreSQL and says:

- “Save this data”
- “Get this data”
- PostgreSQL listens. Python works.

_**Step 1: Install Python
**_

- Download from https://python.org
- During install, check Add Python to PATH

 Screenshot here: Python installer with PATH checked

**_Step 2: Install PostgreSQL driver_**

_Open Command Prompt and run:_

Enter fullscreen mode Exit fullscreen mode

pip install psycopg2-binary


_This lets Python talk to PostgreSQL._

**_Step 3: Simple Python connection_**

_Create a file:_

Enter fullscreen mode Exit fullscreen mode

app.py

_Add this code:_

Enter fullscreen mode Exit fullscreen mode

import psycopg2

conn = psycopg2.connect(
host="localhost",
database="my_app_db",
user="my_user",
password="mypassword"
)

print("Connected to PostgreSQL")


_**Run:**_

Enter fullscreen mode Exit fullscreen mode

python app.py




__If you see Connected to PostgreSQL, it worked.
_

**#############Connecting PostgreSQL to Power BI**
Power BI is a tool to visualize your data charts, tables, dashboards without touching SQL every time.


_**Step 1: Open Power BI Desktop**_

- Download from Power BI Desktop
- Install and launch it

Screenshot here: Power BI Desktop home screen


_**Step 2: Get Data from PostgreSQL**_

- Click Home → Get Data → More → Database → PostgreSQL

- Enter:
Server: _localhost_
Database: _my_app_db_

- Click OK

Screenshot here: PostgreSQL connection popup

_**Step 3: Enter credentials**_

- Username: _my_user_
- Password: _mypassword_
- Click Connect


_**Step 4: Select tables**_

- Power BI shows a list of tables from your database
- Select the table(s) you want
- Click Load

Screenshot here: Loaded tables in Power BI


_**Step 5: Build visuals**_

- Drag fields onto the canvas
- Create charts, tables, or dashboards
- Use filters to explore your data

N/B: Power BI does not change the database; it only reads the data.

_**Step 6: Refresh your data**_

- If PostgreSQL data changes, click Refresh in Power BI
- Your visuals update automatically


_**Why this matters for beginners**_

- You can analyze real data quickly.
- Works with Git projects: save _.pbix_ files in your project folder.
- Combine with Python & SQL for full workflow.

**##############Connecting PostgreSQL to Excel**

- Excel helps you view and analyze data from PostgreSQL using tables, filters, and charts.
- PostgreSQL stores the data.
- Excel shows the data.

_**Step 1: Open Excel**_

- Open Microsoft Excel
- Click Data (top menu)

 Screenshot here: Excel Data tab


_**Step 2: Get data from PostgreSQL**_

1. Click Get Data
2. Choose From Database
3. Select From PostgreSQL Database

Screenshot here: Get Data → PostgreSQL option



_**Step 3: Enter database details**_

Fill in:

- Server: _localhost_
- Database: _my_app_db_
- Click OK

Screenshot here: PostgreSQL connection window

_**Step 4: Enter login details**_

- Username: _**my_user**_
- Password: _**mypassword**_
- Click Connect

_**Step 5: Select tables**_

- Excel shows available tables
- Select the table you want
- Click Load
- Your PostgreSQL data appears in Excel.

Screenshot here: Table loaded in Excel


_**Step 6: Refresh data**_


- If data changes in PostgreSQL:
- Click Refresh
- Excel updates automatically

Screenshot here: Refresh button

_**Why beginners love this:**_

- No SQL needed after setup
- Easy charts & filters
- Works well with Power BI later

_**Important beginner tip**_

1. Don’t edit important data directly in Excel
2. Use Excel mainly for reading and analysis


**Final Words**

So folks, that’s all we had to learn for today.
May the forces of Data, the glory of Science, and the blessings of Analytics and Engineering always be on your side.

_**Remember this:**_

1. Make it easy
2. Don’t rush

- The golden rule: don’t panic, don’t tense
- Every expert you admire once started exactly where you are now.
- Slow steps beat fast mistakes.
- Stay calm, stay curious, and keep building.
- See you in the next one
Enter fullscreen mode Exit fullscreen mode

Top comments (0)