๐ How to Deploy One GitHub Repository to Two Vercel Accounts Automatically
Imagine that you have one private GitHub repository, but you need the same application deployed to two completely separate Vercel Accounts.
Perhaps one belongs to you and another belongs to a client. Or maybe you want the same codebase available in two independent environments.
Doing this manually every time you make a change quickly becomes repetitive.
A better approach is to let GitHub Actions handle the deployment automatically using separate Vercel Tokens.
The workflow then becomes:
Code Change โ git push โ GitHub Actions โ Vercel Account A โ Vercel Account BOnce configured correctly, a normal Git push can trigger both deployments automatically.
๐ What Is a Vercel Token?
A Vercel Token is an authentication credential that allows tools such as the Vercel CLI to access Vercel on your behalf.
If you have two separate Vercel Accounts, you can create a separate token for each one.
For example:
VERCEL_TOKEN_A VERCEL_TOKEN_BGitHub Actions can then use these secrets to authenticate each deployment.
โ ๏ธ Important: Never place Vercel Tokens directly inside your source code. Treat them like passwords and store them as GitHub Actions Secrets.
๐ ๏ธ Step 1: Create Tokens for Both Vercel Accounts
Log in to Vercel Account A.
Go to:
Account Settings โ Tokens โ Create Token
You can give it a descriptive name such as:
TOKEN_ACCOUNT_AGenerate the token and store it securely.
Then repeat the process with Account B:
TOKEN_ACCOUNT_BYou now have separate credentials for both deployment targets.
๐ Step 2: Store Both Tokens in GitHub Secrets
Open your private GitHub repository.
Go to:
Settings โ Secrets and variables โ Actions
Select New repository secret.
Create the first secret:
Name: VERCEL_TOKEN_A Value: Account A tokenThen create:
Name: VERCEL_TOKEN_B Value: Account B tokenGitHub Actions can now access these credentials without exposing the actual token inside your workflow code.
โ๏ธ Step 3: Create the GitHub Actions Workflow
Inside your project, create:
.github/workflows/deploy.ymlA basic workflow can look like this:
name: Multi-Vercel Deployment on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Deploy to Vercel Account A run: npx vercel --token=${{ secrets.VERCEL_TOKEN_A }} --prod --yes - name: Deploy to Vercel Account B run: npx vercel --token=${{ secrets.VERCEL_TOKEN_B }} --prod --yesThe first deployment authenticates with Account A's token.
The second uses Account B's token.
๐ Step 4: Push Your Code
Now make a normal Git push:
git add . git commit -m "Update website" git push origin mainThe moment GitHub receives the push, the workflow starts automatically.
GitHub Actions runs the deployment steps one after another and sends the application to both Vercel deployment targets.
You no longer need to open both Vercel dashboards and manually trigger deployments.
๐ The Complete Deployment Architecture
Developer โ โ git push โผ GitHub Repository โ โผ GitHub Actions โ โโโโโโโโโโโโโโโโโ โผ โผ Vercel Account A Vercel Account B โ โ โผ โผ Website A Website BThis is a simple example of CI/CD automation.
Your Git repository becomes the source of truth, while GitHub Actions handles the deployment workflow.
๐ก One Important Detail: Project Scope Matters
There's an important detail that shouldn't be overlooked.
Using two different Vercel Tokens does not automatically guarantee that every deployment will land in the correct existing Vercel Project.
Vercel also has Project and Team/Account Scope concepts.
If Account A and Account B contain separate Vercel Projects, each deployment needs to be associated with the correct project and scope.
The architecture should therefore look something like:
GitHub Repository โ โโโโ Vercel Project A โ โโโ Account A โ โโโโ Vercel Project B โโโ Account BThis becomes especially important when the two deployments use different domains, environment variables, or production configurations.
๐ Keep Your Tokens Secure
Vercel Tokens should be treated as sensitive credentials.
Never:
โ Hard-code them in source code.
โ Commit them to .env files in Git.
โ Put them inside README files.
โ Share them through screenshots or chat.
Instead:
โ Store them in GitHub Secrets.
If a token is accidentally exposed, revoke it immediately and generate a replacement.
๐ฏ Who Can Benefit From This Setup?
This approach can be useful for:
- Developers managing multiple Vercel Accounts
- Agencies working with client projects
- Teams maintaining independent deployments
- Developers using one private repository for multiple environments
- Businesses that need separate production deployments
- Teams building automated CI/CD pipelines
โก Quick Summary
| Requirement | Solution |
|---|---|
| Private Source Code | GitHub Repository |
| Automation | GitHub Actions |
| Vercel Authentication | Vercel Token |
| Account A | VERCEL_TOKEN_A |
| Account B | VERCEL_TOKEN_B |
| Deployment Trigger | git push |
| Hosting | Vercel |
โ Final Thoughts
Deploying one GitHub repository to multiple Vercel Accounts doesn't have to mean managing every deployment manually.
With GitHub Actions and separate Vercel Tokens, the process can become part of your normal Git workflow.
The basic architecture is simple:
GitHub โ GitHub Actions โ Vercel Account A + Vercel Account B
The important part is keeping credentials secure and making sure each deployment is correctly associated with its intended Vercel Project and Account scope.
Once everything is configured properly, your workflow becomes much cleaner:
Write code โ commit โ push โ deployments happen automatically.
That's the real advantage of CI/CDโnot simply faster deployments, but removing repetitive deployment work from the development process.
---ends here---
