Skip to content

Push to GitHub

Before deploying ForgeDocs to Netlify (or any other host), you need to push your project to GitHub.

GitHub is where your project lives online. Every time you push a change, your hosting provider rebuilds the site automatically.

This guide walks you through the process — even if you’ve never used Git or GitHub before.

Git is a version control system. It tracks changes to your files.

GitHub is a website that hosts Git repositories. It’s where your project lives online.

When you push to GitHub, you’re uploading your project. When your host (Netlify, Vercel, Cloudflare) is connected to GitHub, it rebuilds your site every time you push.

To check if Git is installed, run:

Terminal window
git --version

If you see a version number, you’re ready.

The first time you use Git, set your name and email:

Terminal window
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"

Use the same email you used to sign up for GitHub.

  1. Go to github.com/new
  2. Repository name: forgedocs (or any name you like)
  3. Description: optional
  4. Visibility: Private (recommended) or Public
  5. Do NOT check “Add a README file”
  6. Do NOT add a .gitignore
  7. Do NOT choose a license
  8. Click Create repository

After creating, GitHub shows you a page with setup instructions. Keep this page open — you’ll need the URL.

Open your terminal and navigate to your project folder:

Terminal window
cd C:\Users\YourName\Desktop\forgedocs

Then run:

Terminal window
git init

This creates a hidden .git folder in your project.

Before pushing, you need to tell Git which files to ignore. Create a file called .gitignore in your project root:

On Windows (Command Prompt):

Terminal window
type nul > .gitignore

On macOS:

Terminal window
touch .gitignore

Open .gitignore in your code editor and add:

# Dependencies
node_modules/
# Build output
dist/
.astro/
# Environment
.env
.env.local
# OS files
.DS_Store
Thumbs.db
# Editor
.vscode/
.idea/
# Logs
*.log
npm-debug.log*

Why this matters: node_modules/ can be hundreds of megabytes. You never push it to Git. Your host runs npm install on the server instead.

Add all files (except those in .gitignore):

Terminal window
git add .

To verify what’s staged:

Terminal window
git status

You should see a list of files, all in green.

Create your first commit:

Terminal window
git commit -m "Initial commit"

The message Initial commit is a description of what this commit does. For the first commit, this is standard.

GitHub uses main as the default branch name:

Terminal window
git branch -M main

If your Git already uses main, you’ll see no error — that’s fine.

Back on the GitHub page from Step 2, copy the repository URL. It looks like:

https://github.com/yourusername/forgedocs.git

In your terminal, run:

Terminal window
git remote add origin https://github.com/yourusername/forgedocs.git

Replace yourusername with your actual GitHub username.

Finally, push your project:

Terminal window
git push -u origin main

You’ll be asked for your GitHub username and password. Use a Personal Access Token, not your password.

GitHub no longer accepts passwords for Git operations. You need a Personal Access Token:

  1. Go to github.com/settings/tokens
  2. Click Generate new token → Generate new token (classic)
  3. Note: ForgeDocs
  4. Expiration: 90 days (or No expiration for convenience)
  5. Scopes: check repo (full control of private repositories)
  6. Click Generate token
  7. Copy the token immediately — you won’t see it again

When Git asks for a password, paste the token.

Tip: Save the token somewhere safe. You’ll need it for future pushes.

Refresh your GitHub repository page. You should see all your files there.

If you see them, the push was successful.

After every change you make locally:

Terminal window
git add .
git commit -m "Description of change"
git push

Three commands. That’s it.

Example workflow:

Terminal window
# You edited a blog post
git add .
git commit -m "Update blog post about Astro themes"
git push

Your host rebuilds the site automatically within 1–2 minutes.

Git is not installed. Download it from git-scm.com and restart your terminal.

You’re not in your project folder, or git init wasn’t run. Run cd to navigate to your project and try again.

You’re using SSH but haven’t set up SSH keys. Either set up SSH keys, or use HTTPS instead (the URL starting with https://).

You used your GitHub password instead of a Personal Access Token. See Step 9.

Someone else pushed changes, or you made changes on GitHub directly. Pull first:

Terminal window
git pull --rebase
git push

Files are pushed but you can’t see them on GitHub

Section titled “Files are pushed but you can’t see them on GitHub”

Check that .gitignore doesn’t accidentally exclude the files. Open .gitignore and verify.

If you prefer a visual interface, GitHub Desktop works well:

  1. Download and install GitHub Desktop
  2. Sign in with your GitHub account
  3. Click Add → Add Existing Repository → select your project folder
  4. Make changes in your editor
  5. In GitHub Desktop, write a commit message and click Commit
  6. Click Push

No terminal needed.

Now that your project is on GitHub, deploy it:

→ Deploy to Netlify

Or deploy to another host:

→ Deploy to Others

If you’re stuck: