Push to GitHub
Push to GitHub
Section titled “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.
What Is Git and GitHub?
Section titled “What Is Git and GitHub?”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.
What You Need
Section titled “What You Need”- A GitHub account — sign up here (free)
- Git installed on your computer — download here
- Your ForgeDocs project folder
To check if Git is installed, run:
git --versionIf you see a version number, you’re ready.
Step 1 — Configure Git
Section titled “Step 1 — Configure Git”The first time you use Git, set your name and email:
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.
Step 2 — Create a GitHub Repository
Section titled “Step 2 — Create a GitHub Repository”- Go to github.com/new
- Repository name:
forgedocs(or any name you like) - Description: optional
- Visibility: Private (recommended) or Public
- Do NOT check “Add a README file”
- Do NOT add a
.gitignore - Do NOT choose a license
- Click Create repository
After creating, GitHub shows you a page with setup instructions. Keep this page open — you’ll need the URL.
Step 3 — Initialize Git in Your Project
Section titled “Step 3 — Initialize Git in Your Project”Open your terminal and navigate to your project folder:
cd C:\Users\YourName\Desktop\forgedocsThen run:
git initThis creates a hidden .git folder in your project.
Step 4 — Create a .gitignore File
Section titled “Step 4 — Create a .gitignore File”Before pushing, you need to tell Git which files to ignore. Create a file called .gitignore in your project root:
On Windows (Command Prompt):
type nul > .gitignoreOn macOS:
touch .gitignoreOpen .gitignore in your code editor and add:
# Dependenciesnode_modules/
# Build outputdist/.astro/
# Environment.env.env.local
# OS files.DS_StoreThumbs.db
# Editor.vscode/.idea/
# Logs*.lognpm-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.
Step 5 — Add Files to Git
Section titled “Step 5 — Add Files to Git”Add all files (except those in .gitignore):
git add .To verify what’s staged:
git statusYou should see a list of files, all in green.
Step 6 — Commit Your Changes
Section titled “Step 6 — Commit Your Changes”Create your first commit:
git commit -m "Initial commit"The message Initial commit is a description of what this commit does. For the first commit, this is standard.
Step 7 — Rename the Branch to Main
Section titled “Step 7 — Rename the Branch to Main”GitHub uses main as the default branch name:
git branch -M mainIf your Git already uses main, you’ll see no error — that’s fine.
Step 8 — Connect to GitHub
Section titled “Step 8 — Connect to GitHub”Back on the GitHub page from Step 2, copy the repository URL. It looks like:
https://github.com/yourusername/forgedocs.gitIn your terminal, run:
git remote add origin https://github.com/yourusername/forgedocs.gitReplace yourusername with your actual GitHub username.
Step 9 — Push to GitHub
Section titled “Step 9 — Push to GitHub”Finally, push your project:
git push -u origin mainYou’ll be asked for your GitHub username and password. Use a Personal Access Token, not your password.
Creating a Personal Access Token
Section titled “Creating a Personal Access Token”GitHub no longer accepts passwords for Git operations. You need a Personal Access Token:
- Go to github.com/settings/tokens
- Click Generate new token → Generate new token (classic)
- Note:
ForgeDocs - Expiration: 90 days (or No expiration for convenience)
- Scopes: check
repo(full control of private repositories) - Click Generate token
- 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.
Step 10 — Verify the Push
Section titled “Step 10 — Verify the Push”Refresh your GitHub repository page. You should see all your files there.
If you see them, the push was successful.
Making Future Changes
Section titled “Making Future Changes”After every change you make locally:
git add .git commit -m "Description of change"git pushThree commands. That’s it.
Example workflow:
# You edited a blog postgit add .git commit -m "Update blog post about Astro themes"git pushYour host rebuilds the site automatically within 1–2 minutes.
Common Issues
Section titled “Common Issues”git: command not found
Section titled “git: command not found”Git is not installed. Download it from git-scm.com and restart your terminal.
fatal: not a git repository
Section titled “fatal: not a git repository”You’re not in your project folder, or git init wasn’t run. Run cd to navigate to your project and try again.
Permission denied (publickey)
Section titled “Permission denied (publickey)”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://).
Authentication failed
Section titled “Authentication failed”You used your GitHub password instead of a Personal Access Token. See Step 9.
Updates were rejected
Section titled “Updates were rejected”Someone else pushed changes, or you made changes on GitHub directly. Pull first:
git pull --rebasegit pushFiles 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.
Optional — Using GitHub Desktop
Section titled “Optional — Using GitHub Desktop”If you prefer a visual interface, GitHub Desktop works well:
- Download and install GitHub Desktop
- Sign in with your GitHub account
- Click Add → Add Existing Repository → select your project folder
- Make changes in your editor
- In GitHub Desktop, write a commit message and click Commit
- Click Push
No terminal needed.
What’s Next
Section titled “What’s Next”Now that your project is on GitHub, deploy it:
Or deploy to another host:
Need Help?
Section titled “Need Help?”If you’re stuck:
- Check the FAQ
- Email creativebydre@gmail.com
- For custom work, hire me on Fiverr