GitHub Push - Upload Your Project to GitHub
After you finish customizing your Docusar site on your local computer, you must push it to GitHub. Why? Because hosting providers like Vercel, Netlify, and Cloudflare Pages deploy directly from GitHub. Without GitHub, you cannot make your site live.
This is a complete guide from zero, even if you have never used GitHub before.
Prerequisites
- You have Node.js installed and your Docusar project runs locally with
npm run start - You have a terminal / command prompt (on Windows, use Git Bash or PowerShell. On Mac, use Terminal)
- You have Git installed. Check with
git --version. If not installed, download it from https://git-scm.com
Step 1: Create a GitHub Account
- Go to https://github.com
- Click Sign up on the top right
- Enter your email, create a password, and choose a username
- Verify your email by entering the code sent to your inbox
- After verification, you are logged in to GitHub
Step 2: Create a New Repository
A repository (repo) is a place to store your project.
- After logging in, click the + icon on the top right > New repository
- Fill in:
- Repository name:
docusar-docsormy-docs(use lowercase, no spaces) - Description: Optional - "My Docusar documentation site"
- Visibility: Choose Public (free hosting needs a public repo for the free plan) or Private
- Important: Do NOT check "Add a README file", "Add .gitignore", or "Choose a license". Leave all unchecked.
- Repository name:
- Click Create repository
- After creation, you will see a page with commands. Keep this page open. You will see your repository URL like:
https://github.com/yourusername/docusar-docs.git
Step 3: Create a Personal Access Token (PAT)
GitHub no longer allows passwords for pushing. You must create a token. This token acts as your password.
- In GitHub, click your profile picture on the top right > Settings
- Scroll down in the left sidebar, click Developer settings
- Click Personal access tokens > Tokens (classic)
- Click Generate new token > Generate new token (classic)
- Fill in:
- Note:
docusar-deploy-token - Expiration: Choose
90 daysorNo expirationfor simplicity - Scopes: Check
repo(this will check all sub-options). This gives access to push to repositories.
- Note:
- Click Generate token at the bottom
- GitHub will show your token starting with
ghp_.... COPY IT IMMEDIATELY and save it in Notepad. You will not see it again. Example:ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890
This token is what you will use as the password when pushing.
Step 4: Prepare Your Local Project
Open a terminal and go to your Docusar project folder.
On Windows:
cd C:\Users\YourName\Documents\docusar
On Mac:
cd ~/Documents/docusar
Check if Git is already initialized:
git status
If it says fatal: not a git repository, you need to initialize it. If it shows files, you already have Git.
Step 5: First Push to GitHub
Run these commands one by one in your terminal. Replace yourusername and yourrepo with your actual GitHub username and repo name, and yourtoken with the token you copied.
If this is a brand new project (you downloaded the template, not cloned it):
git init
git add .
git commit -m "first commit - docusar setup"
git branch -M main
git remote add origin https://yourtoken@github.com/yourusername/yourrepo.git
git push -u origin main
Real example with real values:
git init
git add .
git commit -m "first commit - docusar setup"
git branch -M main
git remote add origin https://ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890@github.com/johndoe/docusar-docs.git
git push -u origin main
What each command does:
git init- Initializes Git in your projectgit add .- Adds all files to be trackedgit commit -m "message"- Saves a snapshot with a messagegit branch -M main- Renames the branch to main (GitHub standard)git remote add origin URL- Connects your local project to the GitHub repogit push -u origin main- Uploads files to GitHub
If the push is successful, you will see Writing objects: 100% and your files will appear on the GitHub website. Refresh your GitHub repo page to see them.
If You Already Cloned the Repo Before:
If you started by cloning git clone https://github.com/..., you do not need git init and remote add. Just run:
git add .
git commit -m "update homepage and docs"
git push https://yourtoken@github.com/yourusername/yourrepo.git
Step 6: How to Push Updates Later
Every time you edit your site (change JSON, add docs), you need to push again:
git add .
git commit -m "update product page"
git push https://yourtoken@github.com/yourusername/yourrepo.git
If you used git push -u origin main before, next time you can just run git push.
Common Errors and Solutions
Error: Authentication failed
You used the wrong token or wrong username. Generate a new token and check the URL. Make sure the token is included before @github.com.
Error: remote origin already exists
You already added the remote. Run git remote remove origin and then add it again, or use git remote set-url origin https://yourtoken@github.com/...
Error: failed to push, updates were rejected
Your GitHub repo has files that your local copy does not have (like README). Run git pull origin main --allow-unrelated-histories and then push again.
After a successful push, your project is now safely on GitHub and ready for deployment in the next step.