How to connect GitHub repository on Netlify
Link your GitHub repo to Netlify via the dashboard under Build & deploy for automatic deploys on git push. Authorize the Netlify GitHub App, select your repo, and configure build settings like branch, build command, and publish directory. Troubleshoot common OAuth or permission issues by revoking/re-authorizing apps and clearing browser cache.
Prerequisites
- Netlify account logged in at app.netlify.com
- GitHub account with a repository ready (public or private)
- Admin access to the GitHub repo
- Browser with JavaScript enabled (Chrome/Firefox recommended)
- Repo pushed to deploy branch like main or master
Step-by-Step Instructions
Log into Netlify dashboard
app.netlify.com and select the target site from your Sites list. For a new site, click Add new site > Import an existing project.Navigate to Continuous deployment
Select GitHub provider
Authorize Netlify GitHub App
Configure deployment settings
main), Base directory (default: /), Build command (e.g. npm run build for React/Vite or empty for static), and Publish directory (e.g. dist or build).Handle private repos with deploy keys if needed
Deploy and link site
git push to the linked branch will auto-deploy.Alternative: Create new site from GitHub
CLI method setup
npm install netlify-cli -g or brew install netlify-cli on macOS. Run netlify login to authenticate, then from your local repo directory use netlify init to link.Common Issues & Troubleshooting
"Verification Failed", "We already have a registered user with this email", or "Your account requires additional verification"
Log into Netlify with email/password (reset if needed). Go to Netlify <strong>Settings > Connected Accounts</strong>, disconnect GitHub. Clear browser cache/cookies, retry in incognito. In GitHub <strong>Settings > Applications > Authorized OAuth Apps</strong>, revoke Netlify and re-authorize.
Repository not listed or permission denied
Verify repo admin access. In GitHub, adjust Netlify GitHub App permissions to include the repo (all repos or specific). Use <strong>Link to a different repository</strong> option in Netlify.
Deploy fails on private repo/submodules
Generate and add Netlify deploy key to GitHub repo settings > Deploy keys. Ensure SSH access for private repos.
OAuth token conflict or stale auth
Revoke Netlify apps in GitHub settings, log out everywhere, clear browser cache, and re-authorize using incognito mode.
Build settings mismatch causing deploy failure
Double-check branch name, build command (e.g. <code>npm run build</code>), and publish directory (e.g. <code>dist</code>) match your project structure.