How to Deploy a Website on Vercel
This post guides a user to deploy their website on vercel.
Quick overview
- Make or update your site locally.
- Create a GitHub repo and push your local code.
- Connect GitHub to Vercel and import the repo.
- Configure build settings (if needed) and deploy.
- Make further changes locally as following:
local changes → push to GitHub → Vercel auto-deploys
Prerequisites
- Git installed (git --version).
- A GitHub account.
- A Vercel account (you can sign up with GitHub).
- Your project folder ready locally (with package.json for JS frameworks, or plain static files).
Make sure your local project is up to date
- Open your project folder in your terminal / VS Code.
- If your project already has git tracking, fetch and pull remote changes first:
git status git pull origin main
- Make your changes locally (edit HTML, CSS, React components, build config, etc.).
- Test locally:
- Plain HTML: open index.html in browser.
- React/Vite: npm install then npm run dev (or pnpm/yarn).
- Next.js: npm run dev.
Initialize Git and commit changes
If you don’t have a git repo yet:
cd /path/to/your/project git init git add . git commit -m "Initial commit — project ready for Vercel"
If you already have a repo, just add and commit your latest changes:
git add . git commit -m "Your descriptive message about changes"
Tip: Add a .gitignore for node projects (node_modules, .env, etc.):
node_modules/ .env dist/ .build/
Connect local repo to GitHub and push
# replace URL with your repo's URL git remote add origin https://github.com/your-username/your-repo.git # push for the first time (set upstream) git branch -M main git push -u origin main
Sign in to Vercel and connect GitHub
- Go to https://vercel.com and Sign up / Log in.
- You can sign in with GitHub, this is easiest because Vercel will ask for repo access.
- When prompted, give Vercel permission to access your GitHub account. You can grant access to all repos or only selected ones. (Selecting your project repo is sufficient.)
- After login, on the Vercel dashboard, click New Project → Import Git Repository.
Import your GitHub repo into Vercel
- On the import screen, pick your repository from the list (you can search).
- Vercel will attempt to detect the framework automatically. Confirm the Framework Preset (e.g., Next.js, React (Vite), Svelte, or “Other” for plain static sites).
- Confirm Build & Output Settings:
- Build Command (common defaults):
- Next.js: next build
- Create React App: npm run build
- Vite: npm run build
- Static HTML: leave blank or use a custom script if you have one.
- Output Directory:
- CRA: build
- Vite: dist
- Next.js: (Vercel uses .next internally; leave default)
- Static HTML: / or leave default
- If your repository is a monorepo or the site lives in a subfolder, set the Root Directory to that subfolder (e.g., web/).
- Choose the Git branch to deploy (usually main).
- Add any Environment Variables required at build/runtime (ex: API_KEY, NEXT_PUBLIC_*). You can add them under the Environment Variables section (select Production / Preview as needed).
Deploy
- Click Deploy (or Import & Deploy).
- Vercel will:
- Clone your GitHub repo,
- Run install (npm ci or npm install) and the build command,
- Deploy the static output or serverless functions.
- You’ll see build logs in the Vercel web UI. A successful deploy results in a live URL like https://your-repo.vercel.app (or a random project name if you didn’t set one).
Check the live site & logs
- Click the production URL from the Vercel dashboard to see the live site.
- If the build failed, open the Build Logs in Vercel — they show install, build, and output stages and error traces. Fix locally, commit, push, and Vercel will re-trigger.
Common build errors and quick fixes:
- Module not found / dependency errors:
- run npm install locally and check package.json.
- Wrong build command / wrong output dir:
- update build settings in Vercel project settings.
- Node version mismatch:
- add engines.node to package.json or set Node version in package.json or via Vercel settings.
Continuous Deployment
- Make changes locally.
- git add . && git commit -m "Describe change".
- git push origin main (or push to whatever branch you configured).
- Vercel detects the new push and automatically creates a new deployment.
- For main → Production deployment.
- For other branches / Pull Requests → Preview deployments (great for testing before merging).
Wait a few seconds to a minute for the build to start, you’ll see a new deployment in Vercel dashboard and logs.
Important: You do not need to log into Vercel to deploy changes after the initial setup, pushing to GitHub is enough.
Conclusion
Deploying a website to Vercel from GitHub is a smooth and beginner-friendly process once your workflow is set up. You simply update your project locally, commit and push those changes to GitHub, and Vercel automatically handles the entire deployment pipeline for you. After the initial setup, you don’t need to manually redeploy anything, every push instantly triggers a fresh build and updates your live site within seconds. This lets you focus on building features and improving your project, while Vercel takes care of the hosting, versioning, and production environment behind the scenes.