How to push a website project to GitHub
Pushing a website project to GitHub puts its code in a repository you control, with a history of every change. From a builder, that means granting it permission to write to your repositories, choosing or creating a repository, and pushing. The access grant is the part to understand before you click.
Why put the site in a repository
- A copy you own, on a service separate from the builder, with every version recorded.
- A place for a developer to work, with branches, reviews and pull requests.
- Deployment hooks. Most hosting platforms can deploy automatically whenever the repository changes.
- A paper trail. Each push is a commit you can compare, revert or audit.
Understand the access you're granting
To write to private repositories on your behalf, a tool needs a GitHub OAuth grant with the repo scope. GitHub's scope documentation describes repo as full access to your public and private repositories, including code. It's broad; GitHub's OAuth scopes don't allow narrowing it to one repository. So grant it only to tools you trust, and revoke it when you stop using them.
In Anticode, connecting GitHub for pushes is a separate grant from signing in with GitHub, so signing in never asks for repository access. The token is stored encrypted and used only for the pushes you ask for.
Push from Anticode, step by step
- Open the project in the builder and go to the console's Settings.
- In the GitHub card, choose Connect GitHub. GitHub shows what Anticode is asking for; approve it if you're happy.
- Back in Settings, you'll see which GitHub account is connected. Choose A new private repository or An existing repository.
- Type the repository name, such as
hollis-physio-site, orowner/namefor an existing one you can push to. - Press Push to GitHub. The project is exported as a Next.js app and pushed as one commit on the repository's default branch.
- Open the repository on GitHub and check the files are there, starting with
README.md.
Pushing again later adds or updates files in a new commit. It doesn't delete files already in the repository, so changes a developer added in their own files stay. For what's inside the project, see how to export an AI-built website to Next.js.
Private or public?
Start private. A business site's code rarely benefits from being public, and private repositories avoid accidentally publishing configuration or notes. The exported project keeps secrets in an environment file that its .gitignore excludes, but check before you make anything public: open the repository and search for keys, passwords and email addresses. If a real secret was ever committed, treat it as exposed: revoke it and issue a new one, because it stays in the history even after you delete the file.
What to do with the repository next
- Deploy it
- Connect the repository to a Node host, such as Vercel, and add the environment variables from
.env.example. Each push then deploys. - Protect the main branch
- In the repository's settings, require pull requests for changes to the default branch, so nothing reaches production unreviewed.
- Add collaborators carefully
- Give developers the lowest role that lets them work, and remove access when a project ends.
- Decide where changes happen
- If a developer edits the code in GitHub, pushing again from Anticode will overwrite files with the same names. Agree which side is the source of truth.
Common mistakes
- Pushing into a repository with other projects in it. Use a dedicated repository per site.
- Forgetting the grant exists. Review authorised OAuth apps in your GitHub settings now and then, and revoke ones you no longer use.
- Treating the repository as a backup of form data. Code isn't data; submissions and database rows aren't in it.
Limits
The push is one way: from Anticode to GitHub. Commits made on GitHub aren't pulled back into the Anticode project. Pushing doesn't deploy anything by itself, and Anticode's hosting, checks and backups don't cover a site you deploy from the repository. To disconnect, use Disconnect GitHub in Settings; code already pushed stays on GitHub. You can also revoke the grant from GitHub's own settings.
Questions people ask
Do I need a GitHub account?
Yes. A free account can hold private repositories.
Does pushing delete anything in my repository?
No. Each push adds or updates files in one commit on the default branch. Files already there are left alone.
Can a coding agent work on the repository?
Yes, it's a standard Next.js project. For agents that edit the Anticode project itself instead, there's the open project format and the CLI.
Sources
- GitHub Docs: Scopes for OAuth apps, checked