← Back to list

How to Connect GitHub to Your Local Project:

The Complete End-to-End Workflow

Aryalakshmi NB · 2026-06-03 04:03 · 0 claps · 3.6 min read paywalled
#git #github #ai-agent #code-quality #git-and-github
Open on Medium ↗
Wiki topics: AGT · AI Agents 🔓 · Open Source

How to Connect GitHub to Your Local Project:

The Complete End-to-End Workflow

If you’re building AI projects, software applications, or automation tools, one of the first skills you need is connecting your local project on your laptop to your GitHub account. Once connected, every change you make can be tracked, versioned, and uploaded to GitHub with a few commands.

This guide covers the complete workflow from creating a GitHub account to pushing code updates from your laptop.

Connect GitHub to Your Local Project

Connect GitHub to Your Local Project

Why do we connect GitHub to our Local Project?

GitHub acts as A backup of your code A collaboration platform A version control system A portfolio of your projects * A deployment source for many cloud platforms. Without GitHub, if your laptop fails, your project may be lost.

Step 1: Create a GitHub Account

Go to the GitHub Official Website. Create an account and verify your email.

Example:

Username: johnsmith Email: john@example.com

Step 2: Install Git on your Laptop

Git is the software that communicates with GitHub.

Download Git: https://git-scm.com/downloads

Verify installation:

git --version

Expected output:

git version 2.x.x

(Note: Git Commands to be run in Your Terminal)

Step 3: Configure Git with Your GitHub Identity

Run the following commands once.

git config --global user.name “Your Name” git config --global user.email “youremail@email.com”

Example:

git config --global user.name “John Smith” git config --global user.email “john@example.com”

Verify the configuration using the following command.

git config --list

Step 4: Generate an SSH Key

SSH allows secure communication between your laptop and GitHub without entering passwords repeatedly.

Generate key:

ssh-keygen -t ed25519 -C “youremail@email.com”

Press Enter for all prompts.

When you generate an SSH key, Git creates two files inside the .ssh folder:

id_ed25519 → Your private key, which stays on your laptop and should never be shared with anyone. id_ed25519.pub → Your public key, which you can safely add to GitHub so GitHub can recognize and authenticate your laptop when you push code.

Together, these keys allow GitHub to securely verify that code uploads are coming from your computer without requiring a password each time.

Step 5: Copy Your Public SSH Key

Display key:

cat ~/.ssh/id_ed25519.pub

Copy the entire output.

Example:

ssh-ed25519 AAAAC3Nz…. youremail@email.com

Step 6: Add SSH Key to GitHub

Open https://github.com/settings/keys

Click ‘New SSH Key’. Paste your public key. Save.

A verification code will be sent to your email by GitHub. Verify it to continue.

Step 7: Test the Connection

Run: ssh -T git@github.com

Expected output:

Hi username! You’ve successfully authenticated.

Possible Error: If you get this error, ‘ssh: connect to host github.com port 22: Connection timed out’, it means your system cannot reach GitHub’s SSH server on port 22. The fastest fix is to use GitHub SSH over Port 443. Create or edit the SSH config file:

mkdir -p ~/.ssh nano ~/.ssh/config

Add the following and save the file.

Host github.com Hostname ssh.github.com Port 443 User git

Now test again with ssh -T git@github.com

Again, if this warning message (The authenticity of host [ssh.github.com]:443 …. can’t be established. …. … ) appears, Git is verifying GitHub’s identity and asking whether you trust the server. Type yes and press Enter to continue.

That’s it. Your laptop is now linked to your GitHub account.

Step 8: Create a New GitHub Repository

Create a new repository on GitHub. Example: learn-ai. Choose Public or Private.

After creating the repository, GitHub will provide a URL like git@github.com:username/learn-ai.git

Step 9: Create a New Local Project

Example:

mkdir learn-ai cd learn-ai

Add project files such as app.py, README.md, and requirements.txt.

Step 10: Initialize Git

Initialize Git inside your project folder:

git init

Output: Initialized empty Git repository

Git is now tracking your project.

Step 11: Add Files to Git Tracking

Check status: git status

Add all files: git add .

Step 12: Create Your First Commit

A commit is a saved checkpoint.

git commit -m “Initial project setup”

Example output: 3 files changed

Step 13: Connect Local Project to GitHub Repository

Add remote repository: git remote add origin git@github.com:username/learn-ai.git

Verify: git remote -v

Output: origin git@github.com:username/learn-ai.git

Step 14: Push the Project to GitHub

Rename the branch using git branch -M main, which renames your current branch to main so it matches GitHub’s default branch name and avoids push or synchronization issues.

Push: git push -u origin main. This command uploads your local main branch to the current GitHub repository and sets it as the default remote branch for future pushes and pulls.

Output: Branch ‘main’ set up to track remote branch.

Now, refresh GitHub. Your project files will appear in your GitHub repository.

Once this setup is complete, your laptop project and GitHub repository remain connected. Any future updates follow the simple cycle: Edit Code → git add → git commit → git push → Changes appear on GitHub.

Daily Workflow After Setup

1. Check What Changed: **git status 2. Add Modified Files: git add . or git add filename.py 3. Create a Commit: git commit -m “Added weather prediction module” 4. Upload to GitHub: **git push origin main

That’s it!

Clone an Existing GitHub Repository

If the project already exists on GitHub, clone it using:

git clone git@github.com:username/learn-ai.git, which downloads the project and automatically connects it to GitHub.

You can access all the stories in this series through the links below.

**https://medium.com/@aryanbkrishnan/list/ai-agent-engineer-d801cd8de5a3**

**https://medium.com/@aryanbkrishnan/list/ai-agent-engineer-series-foundations-2a07a7214e66**

Enjoy exploring and learning!

References

  1. https://docs.github.com/en/free-pro-team@latest/authentication/connecting-to-github-with-ssh

메타데이터
post_id
33ded89787e4
slug
how-to-connect-github-to-your-local-project-33ded89787e4
url
https://medium.com/@aryanbkrishnan/how-to-connect-github-to-your-local-project-33ded89787e4
canonical_url
https://medium.com/@aryanbkrishnan/how-to-connect-github-to-your-local-project-33ded89787e4
author_url
https://medium.com/@aryanbkrishnan
status
ok
fetched_at
2026-06-09 15:37:30