GitHub Repository Setup
What Is GitHub?
Section titled “What Is GitHub?”GitHub is a cloud hosting platform for Git repositories. It stores your source code online, tracks every change, and lets you collaborate with others.
For Astro Docus, GitHub is the first step before deployment. Most modern hosting platforms (Cloudflare, Vercel, Netlify) connect directly to GitHub and deploy automatically every time you push code.
Without GitHub:
- You would upload files manually every time you make a change
- You would have no version history
- You could not use automatic deployment
With GitHub:
- One push deploys your site
- Full version history
- Easy rollback if something breaks
- Free for public and private repositories
Step 1 — Create a GitHub Account
Section titled “Step 1 — Create a GitHub Account”If you already have an account, skip to Step 2.
1.1 Sign Up
Section titled “1.1 Sign Up”- Open your browser and go to: https://github.com
- Click the Sign up button in the top-right corner
- Fill in the required information:
- Email address — use one you check frequently
- Password — at least 8 characters, include numbers and lowercase letters
- Username — no spaces, use something like
yourname-dev
- Complete the human verification puzzle
- Click Create account
1.2 Verify Your Email
Section titled “1.2 Verify Your Email”GitHub sends a confirmation email to the address you provided. Open it and click the verification link .
Important: Check your spam folder if you do not see the email within a few minutes.
1.3 Log In
Section titled “1.3 Log In”After verification, go to https://github.com/login and sign in with your credentials .
Step 2 — Install Git Locally
Section titled “Step 2 — Install Git Locally”GitHub stores your code online, but you need Git on your computer to send code there.
2.1 Download Git
Section titled “2.1 Download Git”- Go to: https://git-scm.com
- Download the installer for your operating system
- Run the installer with default settings (click Next through every screen)
- On Windows, make sure “Git from the command line” is selected
2.2 Verify Installation
Section titled “2.2 Verify Installation”Open Command Prompt (Windows) or Terminal (Mac/Linux) and type:
git --versionYou should see something like git version 2.45.1 .
Step 3 — Configure Git with Your Identity
Section titled “Step 3 — Configure Git with Your Identity”Git needs to know who you are. This is a one-time setup .
Run these commands in your terminal (replace with your own details):
git config --global user.name "Your Name"git config --global user.email "your-email@example.com"Use the same email you used to register on GitHub .
To verify the configuration:
git config --global --listStep 4 — Create a New Repository on GitHub
Section titled “Step 4 — Create a New Repository on GitHub”A repository (repo) is like a cloud folder for your project .
4.1 Create the Repository
Section titled “4.1 Create the Repository”- Log in to GitHub
- Click the + button in the top-right corner, then select New repository
- Fill in the form:
| Field | What to enter |
|---|---|
| Repository name | astrodocus or my-docs-site |
| Description | Optional, e.g., “Documentation site built with Astro Docus” |
| Public / Private | Choose Public (easier to deploy) or Private (only you can see) |
| Add a README file | ✅ Check this box |
- Click Create repository
4.2 Copy the Repository URL
Section titled “4.2 Copy the Repository URL”After creation, you land on the repository page. Click the green Code button and copy the HTTPS URL. It looks like:
https://github.com/your-username/astrodocus.gitYou will need this URL in Step 5 .
Step 5 — Push Your Astro Docus Project to GitHub
Section titled “Step 5 — Push Your Astro Docus Project to GitHub”Now connect your local Astro Docus folder to the GitHub repository and upload it.
5.1 Open Terminal in Your Project Folder
Section titled “5.1 Open Terminal in Your Project Folder”- Open VS Code
- Click File → Open Folder and select your Astro Docus project folder
- Open the built-in terminal with Ctrl + ` (backtick)
5.2 Initialize Git and Commit
Section titled “5.2 Initialize Git and Commit”Run these commands one by one:
git initgit add .git commit -m "Initial commit - Astro Docus project"What each command does:
git init— creates a local Git repository in your foldergit add .— stages all files for commitgit commit -m "..."— saves a snapshot with a descriptive message
5.3 Connect to GitHub and Push
Section titled “5.3 Connect to GitHub and Push”Run these commands (replace the URL with your repository URL from Step 4.2):
git remote add origin https://github.com/your-username/astrodocus.gitgit branch -M maingit push -u origin mainWhat each command does:
git remote add origin— links your local repo to the GitHub repogit branch -M main— renames the default branch tomaingit push -u origin main— uploads your files to GitHub
5.4 Authentication
Section titled “5.4 Authentication”When prompted for credentials:
- Username: your GitHub username
- Password: a Personal Access Token (not your account password)
Why a token? GitHub removed password authentication for Git operations. You must create a token instead.
How to create a Personal Access Token:
- Go to GitHub → click your profile picture → Settings
- Scroll down the left sidebar → Developer settings
- Click Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Give it a name (e.g., “Astro Docus deploy”)
- Set expiration to 90 days or more
- Check the repo scope (full repository access)
- Click Generate token
- Copy the token immediately — you will not see it again
Paste this token as your password when Git prompts you.
Step 6 — Verify the Push
Section titled “Step 6 — Verify the Push”- Go to your repository page on GitHub:
https://github.com/your-username/astrodocus - Refresh the page
- You should see all your project files listed —
astro.config.mjs,package.json,src/,public/, etc.
If you see your files, the push succeeded.
Daily Workflow After Setup
Section titled “Daily Workflow After Setup”Once connected, every change follows the same pattern :
git add .git commit -m "Description of what you changed"git pushThis is the cycle you will repeat:
- Edit files locally in VS Code
- Run
git add .to stage changes - Run
git commit -m "message"to save a snapshot - Run
git pushto send to GitHub
Troubleshooting
Section titled “Troubleshooting”| Problem | Solution |
|---|---|
remote: Repository not found | Check the URL with git remote -v and re-add if wrong |
Support for password authentication was removed | Use a Personal Access Token, not your password |
failed to push some refs | Run git pull origin main --allow-unrelated-histories first |
| Git not recognized | Reinstall Git and ensure “Add to PATH” is checked |
| Authentication failed | Regenerate your Personal Access Token with repo scope |
Quick Recap
Section titled “Quick Recap”1. Sign up at github.com2. Verify your email3. Install Git from git-scm.com4. Configure: git config --global user.name/email5. Create a new repository on GitHub (check "Add README")6. In VS Code terminal: git init git add . git commit -m "Initial commit" git remote add origin YOUR_REPO_URL git branch -M main git push -u origin main7. Authenticate with Personal Access Token8. Verify files appear on GitHubYour Astro Docus project is now on GitHub. This is the foundation for automatic deployment to any hosting platform.
👉 Next: docs/deploy-hosting/cloudflare.md — deploy to Cloudflare Pages with GitHub integration.