Git Integration, Repository Remote Setup, and Clone Troubleshooting
How Git integration works for static hosting, pushing a repo with HTTPS or SSH, limits on existing apps, and fixing clone failures.
This page summarizes Cloudflare documentation on connecting a Git repository to a Pages project: what Git integration does, how framework guides and tutorials expect you to create a remote and push main, prerequisites such as SSH keys, framework-specific repository contents, and errors when Pages clones the connected repository.
Git integration: connect a repo for automatic deploys
Section titled “Git integration: connect a repo for automatic deploys”Git integration lets you link a GitHub or GitLab repository to a Pages application so each new commit on the connected branch triggers a build and deployment.
In addition to Direct Upload deployments, you can deploy projects via Git integration. Git integration allows you to connect a GitHub or GitLab repository to your Pages application and have your Pages application automatically built and deployed after each new commit is pushed to it.
— Cloudflare, Deploy an Angular site
The same wording appears in the Nuxt framework guide. Setup assumes you already understand Git; the Angular and Nuxt guides point newcomers to GitHub’s summarized Git handbook for local Git setup.
Can I add Git integration to a Pages app I already created?
Section titled “Can I add Git integration to a Pages app I already created?”No—not on an application that already exists without Git integration. You must create a new Pages application if you want Git integration after you have deployed by another method (for example Direct Upload).
Currently, you cannot add Git integration to existing Pages applications. If you have already deployed your application, you need to create a new Pages application in order to add Git integration to it.
— Cloudflare, Deploy an Angular site
Before you push: Git basics and SSH
Section titled “Before you push: Git basics and SSH”Framework guides and tutorials share a Before you continue block: you need a fundamental understanding of Git, and if you use SSH remotes you need SSH keys on every machine that pushes or pulls.
All of the framework guides assume you already have a fundamental understanding of Git ↗︎. If you are new to Git, refer to this summarized Git handbook ↗︎ on how to set up Git on your local machine.
If you clone with SSH, you must generate SSH keys ↗︎ on each computer you use to push or pull from GitHub.
— Cloudflare, Deploy an Astro site
The Blazor, Hugo, and static HTML guides repeat the same expectations. The Sphinx guide adds a concrete SSH check before pushing: start ssh-agent, add your key, and run ssh -T git@github.com until GitHub confirms authentication (shell access is not provided—that message is normal).
Create a GitHub repository and push your project
Section titled “Create a GitHub repository and push your project”Across Pages tutorials and framework guides, the workflow is: create an empty repository on GitHub (guides say to use repo.new), initialize Git in your project if needed, set the default branch to main, add origin, commit, and push.
Greenfield folder (no scaffold yet)
Section titled “Greenfield folder (no scaffold yet)”Tutorials such as Create a HTML form and Add an HTML form with Formspree start from an empty directory:
mkdir new-projectcd new-projectgit initgit remote add origin git@github.com:<username>/<repo>.gitgit branch -M mainYou then add site files, commit, and push when ready.
Existing app: init, commit, HTTPS remote
Section titled “Existing app: init, commit, HTTPS remote”Most framework guides (for example MkDocs, SvelteKit, Build an API with Pages Functions) use HTTPS:
git initgit remote add origin https://github.com/<your-gh-username>/<repository-name>git add .git commit -m "Initial commit"git branch -M maingit push -u origin mainAngular and Nuxt note you may skip git init, git add ., and the initial commit if you already committed (for example after using C3).
Scaffold first, then attach GitHub
Section titled “Scaffold first, then attach GitHub”The Add a React form with Formspree tutorial creates the app with create-react-app, then adds a remote:
npx create-react-app new-appcd new-appgit remote add origin git@github.com:<username>/<repo>.gitgit branch -M mainSome guides assume Git already exists in the template and only set the remote and push—for example React and Ember:
git remote add origin https://github.com/<your-gh-username>/<repository-name>git branch -M maingit push -u origin main| Situation | Typical first step | Remote style in docs |
|---|---|---|
| Empty site or tutorial folder | git init in project root |
HTTPS or git@github.com:... |
| CLI-generated framework app | Build app, then git remote add |
Often HTTPS in framework guides |
| Repo already initialized (C3, template) | Skip init/commit; set origin and push |
HTTPS |
What belongs in the repository before Pages builds
Section titled “What belongs in the repository before Pages builds”Pages builds from the committed tree. Several guides call out files that must be in the repo, not only on your machine.
Ignore build artifacts and local secrets
Section titled “Ignore build artifacts and local secrets”For .NET Blazor on Pages, generate a root .gitignore so only needed files are pushed:
dotnet new gitignoreLanguage dependencies declared in Git
Section titled “Language dependencies declared in Git”Jekyll on Pages expects a committed Gemfile so the build can run bundle install, including the jekyll gem. MkDocs and Pelican document freezing dependencies into requirements.txt after installing packages locally.
Submodules (themes and vendored code)
Section titled “Submodules (themes and vendored code)”Hugo shows adding a theme as a Git submodule:
git submodule add https://github.com/gohugoio/hugo-mod-ananke.git themes/anankeSubmodule misconfiguration is a frequent clone failure source (see below).
Branch workflows beyond the first push
Section titled “Branch workflows beyond the first push”The code review bot tutorial shows a feature branch and pull request after origin exists:
git checkout -b test-reviewgit add test.jsgit commit -m "Add test file"git push origin test-reviewThat pattern is for testing integrations on GitHub; Pages production deploys still depend on which branch you connected in the Pages project settings.
Cloning git repository: LFS, submodules, and .gitmodules
Section titled “Cloning git repository: LFS, submodules, and .gitmodules”When Git integration fails at cloning git repository, Cloudflare’s Debugging Pages documentation points to Git Large File Storage (LFS) usage and submodule configuration.
LFS problems are tied to how LFS is used in the repo; consult GitHub and GitLab LFS documentation from that page’s links in the live docs. For submodules, the root .gitmodules file must include both path and url for each entry.
Valid example from the debugging guide:
[submodule "example"] path = example/path url = git://github.com/example/repo.gitInvalid examples include a submodule with only path, or only url—either breaks what Pages needs when cloning.
Common mistakes
Section titled “Common mistakes”- Trying to add Git integration to an existing Direct Upload app instead of creating a new Pages application (Angular guide).
- Pushing with SSH without keys on the machine that runs
git push(Astro prerequisite text). - Forgetting
git initor the initial commit when the guide expects them—unless the guide explicitly says to skip (C3 / already committed) (Nuxt). - Committing secrets or huge build output because
.gitignorewas never added (Blazor). - Broken
.gitmodulesafter copying submodule snippets without aurl(Debugging Pages). - Jekyll without
Gemfilein the repo when migrating an existing site (Jekyll guide).
How to check this on your site
Section titled “How to check this on your site”-
On GitHub, confirm the repository exists, the default branch is
main(or the branch you will connect), and the latest commit contains your site source and any required files (Gemfile,requirements.txt,.gitmodules, etc.) per your framework guide. -
From your laptop, run
git remote -vand verifyoriginmatches the HTTPS or SSH URL you intend to use; rungit pushand confirm GitHub shows the new commit. -
If you use SSH, run
ssh -T git@github.comas in the Sphinx guide and confirm GitHub recognizes your account. -
In the Cloudflare dashboard, open your Pages project’s deployment log; if cloning fails, compare your
.gitmodulesand LFS setup against Debugging Pages — Cloning git repository. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match the linked Cloudflare documentation or your deployment behaves differently, email yimasynthetic@gmail.com with the page URL and the exact sentence or command you think is wrong.