uniflow
KO / EN
Dev·판단·2025-11-21

Complete Guide: Common Mistakes Everyone Makes When Uploading a Project from VS Code to GitHub — and How to Fix Them

This is a practical guide that solves the common issues everyone encounters at least once when uploading a project from VS Code to GitHub for the first time—endless “Commit & Push” loading, missing repositories, and accidental node_modules uploads. From fixing remote connections to configuring a proper .gitignore and recovering your first push, this guide summarizes the fastest and most accurate recovery steps based on real-world examples.

A practical, step-by-step handbook for solving everything at once when your first Git integration breaks down When you upload a project from VS Code to GitHub for the first time, the problems people run into are surprisingly similar.

  • The “Commit & Push” button keeps spinning but nothing uploads…
  • No new repository appears on GitHub…
  • node_modules gets pushed and the upload never ends…
  • The remote isn’t configured properly, yet VS Code keeps trying to push…

This guide explains how to fix these issues in one go. Anyone can make mistakes when connecting VS Code → GitHub for the first time. But the principle is simple:

“If the remote is correct, most problems disappear.”

Below is the complete recovery procedure, based on an example project (name changed for privacy: PROJECT_A_2025).


1. If VS Code keeps showing “Commit & Push” but nothing happens

Sometimes VS Code shows a spinner even though it isn’t actually pushing anything.

The first thing to check in the terminal is:

git remote -v
  • If you see nothing → no GitHub remote is connected yet
  • If you see a wrong URL → VS Code is linked to the wrong remote

Either way, fixing the remote is the first step.

If the spinning UI bothers you:

VS Code menu → View → Command Palette → “Developer: Reload Window” This stops the spinner (but the real fix is below).


2. How to create a clean, empty repository on GitHub

Before using VS Code, prepare an empty repository on GitHub.

  1. Log in to GitHub
  2. Click the green New button in the upper-right (or Sidebar → Repositories → New)
  3. Enter a repository name Example: PROJECT_A_2025
  4. Keep Owner as default
  5. Choose Private if this is a personal practice project
  6. Leave the following unchecked:
  • Add a README file
  • .gitignore
  • License
  1. Click Create repository

You will now see a URL like:

https://github.com/dev-user/PROJECT_A_2025.git

This is the remote address you’ll connect from VS Code.

Key points

  • For a brand-new project, always start with an empty repo.
  • Do not create README or .gitignore on GitHub first — it complicates the first push.

3. Re-registering the remote from VS Code

In VS Code, open the project root (e.g., the PROJECT_A_2025 folder) and run:

Advertisement본문 중간 · 반응형본 도메인에서만 게재
git remote remove origin   # Removes incorrect origin (safe to ignore errors)
git remote add origin https://github.com/dev-user/PROJECT_A_2025.git
git branch -M main
git push -u origin main

Explanation:

  • The first line removes any incorrect remote
  • The next lines reconnect your project to the correct GitHub repo
  • push -u origin main sets “main” as the default upstream connection

After this:

  • VS Code’s Commit & Push works normally
  • The GitHub repository will show your code

4. If node_modules was pushed (upload is extremely slow)

If you pushed without a .gitignore, then:

  • node_modules/ gets uploaded
  • Push becomes endlessly slow
  • Sometimes the repo becomes partially corrupted

To fix it without deleting local files, run:

git rm -r --cached node_modules build
git commit -m "Clean repository (remove node_modules & build)"
git push

--cached removes the folders from Git history only, not from your computer.


5. A safe .gitignore template for most projects

Create a .gitignore file in the project root and add:

# Node / JS
node_modules/
dist/
build/
.cache/
.temp/
npm-debug.log*
yarn-debug.log*
pnpm-debug.log*
package-lock.json

# Vite / React
.vite/
*.local

# Env & secrets
.env
.env.*
!.env.example

# OS / IDE
.DS_Store
Thumbs.db
.vscode/

# Logs
*.log
logs/

This ensures:

  • Heavy folders like node_modules and build won’t upload
  • Sensitive files like .env are always excluded

6. Final Checklist — What to verify before your first GitHub push

ChecklistDescription
1. Create GitHub repo properlyUse the green New button → create an empty repository
2. Check remoteRun git remote -v to ensure the origin URL is correct
3. Configure .gitignoreExclude node_modules, build, .env, etc.
4. First push via terminalUse git push -u origin main once manually

Follow these 4 rules, and nearly all common VS Code → GitHub issues disappear.


Closing note

When you first work with Git and GitHub, it’s totally normal to feel like:

“I don’t even know what I clicked wrong.”

But once you understand the structure:

  • Correct remote
  • Proper .gitignore
  • Never push node_modules

…you’ll be able to connect new projects to GitHub in 1–2 minutes, every time.

Advertisement글 최하단 · 띠배너본 도메인에서만 게재