Push on GitHub Repo
Configuration
Before pushing your project to GitHub, you need to set your domain name in two files. This ensures your site’s URLs, sitemap, and SEO metadata are correct.
1. Update astro.config.mjs
Open astro.config.mjs in your code editor and change the site value to your domain name.
JSON code:
export default defineConfig({ site: 'https://localhost:4321'});Replace https://localhost:4321 with your actual domain name, for example:
export default defineConfig({ site: 'https://yourdomain.com'});2. Update src/data/config.json
Open src/data/config.json and change the url field to match.
JSON code:
{ "url": "http://localhost:4321", "title": "Creative Photo ART", "description": "Berkarya lah dengan kegilaan yang mahal, bukan berkarya dengan kemahalan yang gila - The ART of Photography.", "favicon": "/img/astrojs.svg"}Change http://localhost:4321 to your domain name. Both files should now have the same URL.
Push to GitHub
1. Create a GitHub Account
If you don’t have one yet, register at github.com. It’s free.
2. Create a New Repository
Once logged in, create a new repository for your project.
Steps:
- Click the + button in the top-right, then New repository
- Name your repository (for example:
blacks-website) - Choose Public or Private
- Click Create repository
Don’t check “Add a README file” — you’ll push your existing project files instead.
3. Push Your Project
Open your terminal, navigate to your project folder, and run these commands.
Terminal commands:
git initgit add .git commit -m "first commit for my astro website"git remote add origin https://github.com/username/your-repo-namegit push -u origin masterReplace:
username— your GitHub usernameyour-repo-name— your repository name
For example:
git remote add origin https://github.com/creativitas/blacks-websitegit push -u origin master4. Authentication
When prompted for credentials:
- Username: your GitHub username
- Password: a Personal Access Token (not your GitHub password)
GitHub no longer accepts account passwords for Git operations. You need to create a token.
How to create a Personal Access Token:
- GitHub → click your profile picture → Settings
- Scroll down → Developer settings
- Personal access tokens → Tokens (classic)
- Generate new token (classic)
- Name it (for example: “Blacks deploy”)
- Set expiration (90 days recommended)
- Check the repo scope
- Click Generate token
- Copy the token immediately — you won’t see it again
Paste this token as your password when Git asks.
5. Verify the Push
Go back to your GitHub repository page and refresh. You should see all your project files listed.
Common Problems
| Problem | Solution |
|---|---|
remote: Repository not found | Check the URL with git remote -v and re-add it |
Support for password authentication was removed | Use a Personal Access Token, not your password |
failed to push some refs | Run git pull origin master --allow-unrelated-histories first |
| Git not recognized | Install Git from git-scm.com and restart your terminal |
| Authentication failed | Regenerate your Personal Access Token with the repo scope |
Next Step
Your project is now on GitHub. The next step is to deploy it to a hosting provider.
👉 Hosting Deploy — deploy your site to Cloudflare, Netlify, Vercel, or any static host