Got a folder with code on your computer and want to start using Git? Here’s how to add a local project to GitHub Desktop.
When Do You Need This?
- You have a folder with code that isn’t a Git repository yet
- You cloned a project through the terminal and want to open it in a GUI
- You received an archive of a project from a colleague
- You were working on a project without Git and decided to start versioning
Option 1: Add an Existing Git Repository
If the folder is already a Git repository (has a .git folder):
Steps:
- Open GitHub Desktop
- File → Add Local Repository
- Click Choose… and select the folder
- Click Add Repository
✅ Done! The repository appears in GitHub Desktop.
What you’ll see:
- Commit history in the History tab
- Current changes in Changes (if any)
- Current branch in the header
Option 2: Initialize a New Repository
If the folder is not a Git repository:
Steps:
- File → Add Local Repository
- Select the folder with your project
- You’ll see an error: “This directory does not appear to be a Git repository”
- Click Initialize Git Repository or create a repository
GitHub Desktop will create a .git folder automatically!
After initialization:
- All files appear in Changes (untracked)
- Make the first commit:
- Summary:Initial commit
- Click Commit to main
Option 3: Create a New Repository from Scratch
If the project doesn’t exist yet:
Steps:
- File → New Repository
- Fill in:
- Name: project name
- Description: brief description
- Local Path: where to create it
- ✅ Initialize this repository with a README
- Git Ignore: choose a template (Python, Node, Java…)
- License: choose a license (optional) - Create Repository
GitHub Desktop will create the folder and initialize Git!
Understanding the GitHub Desktop Interface
Left panel: Changes
Shows modified files:
✓ new_file.py (green +)
✓ modified.js (yellow dot)
✓ deleted.txt (red -)
Checkboxes — files that will be included in the commit.
Uncheck a file to exclude it from the commit.
Right panel: Diff
Shows exactly what changed:
function hello() {
- console.log("Hello");
+ console.log("Hello World!");
}
- Red lines (- minus) — removed
- Green lines (+ plus) — added
Bottom section: Commit
Two fields:
- Summary — short description (required)
- Description — details (optional)
Common Tasks
Open project in editor
- Repository → Open in Visual Studio Code (or another editor)
- Or: Ctrl+Shift+A (Windows) / Cmd+Shift+A (Mac)
Open folder in file explorer
- Repository → Show in Explorer (Windows)
- Or: Repository → Show in Finder (Mac)
- Or: Ctrl+Shift+F / Cmd+Shift+F
Open terminal in project folder
- Repository → Open in Terminal
- Or: Ctrl+
** (Windows) / **Cmd+(Mac)
Setting Up .gitignore
After adding a project you’ll often need to configure .gitignore:
What is it?
The .gitignore file tells Git which files NOT to track:
- Dependencies (
node_modules/,venv/) - Builds (
dist/,build/,*.pyc) - Configs (
.env,.idea/,.vscode/) - System files (
.DS_Store,Thumbs.db)
How to add:
- Repository → Repository Settings → Ignored Files
- Or create a
.gitignorefile in the project root
Template examples:
Python:
__pycache__/
*.py[cod]
venv/
.env
Node.js:
node_modules/
.npm
.env
dist/
General:
.DS_Store
.idea/
.vscode/
*.log
Troubleshooting
“This directory appears to be a Git repository”
The folder is already a Git repository! Just:
- File → Add Local Repository (don’t create a new one!)
“The repository is missing or not accessible”
Check:
- Is the path correct?
- Do you have access rights to the folder?
- Did you delete the .git folder?
Too many untracked files
Set up .gitignore before the first commit:
- Add
.gitignorewith the necessary patterns - Remove unwanted files from Changes
- Make a commit
Example: Adding a Python Project
# You have a project
my-python-app/
├── app.py
├── requirements.txt
└── venv/ # NOT needed in Git!
Steps:
- Open GitHub Desktop
- File → Add Local Repository
- Select
my-python-app/ - Click create a repository
- Create
.gitignore:
venv/ __pycache__/ *.pyc .env - Only
app.pyandrequirements.txtremain in Changes - Make a commit:
Initial commit
✅ Done! Project is under Git!
What’s Next?
After adding the project:
- ✅ Publish on GitHub (Publish repository)
- ✅ Set up
.gitignore - ✅ Make commits when changes happen
- ✅ Create branches for new features
Your project is now safely under Git! 🚀
💬 Comments (0)
No comments yet
Be the first to share your opinion about this article!