12

enter image description here

I am developing a project with next.js. The project is kept in a secret repository in the company's github account and my github account is authorized in this repository as colabrator. The project's development domain is also connected to the company's vercel account. We can see the changes we make from here.

However, I have been experiencing a problem for two days. When I add new branches, vercel does not give me access to my github account. As far as I understand, the company needs to switch to a pro account.

Despite this, yesterday we re-authenticated GitHub in to Vercel and the new branch I pushed was deployed without errors. I am trying again today and it does not work. I need to merge the new features of the project but I cannot.

11 Answers 11

12

I faced exact same issue and this is how I solved this. Created a new commit by setting git config user email as the vercel platform owner email ID and it worked

for example ; Suppose your vercel owner email ID is [email protected]. make a small change in the code (like adding a space or something). enter following command in terminal and then push to git. Now you will be able to deploy from that specific commit

git config  user.email "[email protected]"
0
7

Switching to an automated CI/CD pipeline with GitHub Actions and triggering deployments via the Vercel CLI has resolved this issue.

Steps to Fix:

  1. Go to GitHub -> Repository Settings -> GitHub Apps -> Vercel Config and either suspend or remove the integration.
  2. Log into your Vercel account to retrieve your Vercel token, Project ID, and Vercel ID. Add these to GitHub secrets under Settings -> Secrets and Variables -> Actions. Screenshot
  3. Configure your GitHub workflow using the template provided in the Vercel documentation.
  4. Once you commit your changes, GitHub will automatically trigger the deployment.
  5. Deployment success screenshot
6

A solution works for me.

  1. Go to you vercel project setting (url likes 'https://vercel.com/your-team/your-project-name/settings/git')
  2. Find 【Deploy Hooks】, if there is no hook, just create one, and the code update would sync to Vercel.

Background that I faced the issue: I deploy a project on Vercel and work well. Today I update my code in git repo and appear the error message. Last time I update code in 60 days ago, and I do nothing change during the days. So I guess maybe Vercel update some project config options or my project configuration somehow changed.

2
  • 2
    Great solution! You also need to add the Deploy Hook URL to GitHub: 1. Get the Deploy Hook URL from Vercel: - Project Settings → Git → Deploy Hooks - Create a hook (e.g., "Auto Deploy") - Copy the generated URL 2. Add it to GitHub: - Repository Settings → Webhooks → Add webhook - Paste the Vercel Deploy Hook URL - Content type: application/json - Select "Just the push event" - Enable SSL verification - Add webhook Now your deployments will trigger automatically when you push to your repository, without needing Vercel team access or changing git config.
    – Abeyance
    Commented Nov 16, 2024 at 19:10
  • Awesome solution! Works like a charm.
    – Aditya
    Commented Jan 2 at 5:48
4

It appears that many of us are facing the same issue. After posting a question in the community, I learned that collaboration is not permitted under the Hobby plan. This was previously allowed due to a bug, but Vercel has recently implemented a fix.

Browse vercel community topic

The only solution is to upgrade to the Pro plan, or do the final commit through the GitHub account that is directly linked to your Vercel account.

For a single project you can achieve this by git config user.email "vercel account email"

Or you may choose to do it globally sudo git config --global user.email "vercel account email"

2
  • NOTE: the email should match the email of your vercel account Commented Oct 28, 2024 at 19:29
  • The email should match the email of your GitHub account not the one of the Vercel account you are deploying to. For example, if you have two repos under the same GitHub account and deploy them on different Vercel accounts (using different emails), the user.email should be the one you use on GitHub.
    – Jack Tsin
    Commented Dec 17, 2024 at 23:55
3

I guess you need to ensure that your GitHub account is still properly authorized to access the repository.

Also try double-checking the project settings in Vercel. Navigate to the Git Integration settings and see if the new branches are properly set up for deployment.

If none of this works try deploying manually. Manually create deployments by commit or branch in the dashboard

1
  • Thank you for your feedback. The company owner obviously doesn't understand these processes very well. He authorized me 1 month ago. I have already made commits without changing anything and the commits I made were deployed in Vercel. The question on my mind is this: If I tell the company owner, give $20 to Vercel and switch to a pro account. Then make me a Vercel member and the problem will be solved, will the problem really be solved?
    – Atticus
    Commented Sep 22, 2024 at 15:40
3

I prefer to have my email and do everything under my name and email address so everything goes under my Github statistics and everybody sees what I did when developing with multiple developers so I don't like the `git config user.email "[email protected]" approach and I commit a failed deployment and when I want to deploy, I have a GitHub account logged in in another browser that can commit to Vercel. There I do a dummy README space/space removal commit in the browser and deploy.

To automate a process where a dummy commit is made using a specific email when a commit is made by someone not using Vercel email I have created a .github/workflows/dummy-commit.yml:

name: Dummy commit if someone else than [email protected]

on:
  push:
    branches:
      - main # Replace with your branch

jobs:
  enforce-email:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Get commit email
        id: get_email
        run: |
          email=$(git log -1 --pretty=format:'%ae')
          echo "Commit email: $email"
          echo "email=$email" >> $GITHUB_ENV

      - name: Check email and perform dummy commit if necessary
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          EMAIL: ${{ env.email }}
        run: |
          if [ "${{ env.EMAIL }}" != "[email protected]" ]; then
            echo "Email does not match. Performing dummy commit."
            git config user.name "username or Name Surname"
            git config user.email "[email protected]"
            echo "Dummy commit at $(date)" > dummyfile.txt
            git add dummyfile.txt
            git commit -m "Dummy commit to deploy"
            git push
          else
            echo "Email matches. No action needed."
          fi

Now, create in your project's root a dummyfile.txt and replace [email protected] in 2 places and username or Name Surname with the Vercel hobby plan Github email/username (or name). Also, replace the main branch if needed. Also, give permissions:

Settings -> Actions -> General -> Workflow permissions

It works, and I'm in a hurry now, but I also plan to squash the dummy commit with the commit that triggered it so as not to clutter the commit history with every second commit being a dummy. I'll update here when done.

2
  • 1
    You don't need to create dummyfile.txt. Just use git commit --allow-empty -m ... and it will create an empty commit with no changes.
    – ADTC
    Commented Dec 28, 2024 at 15:17
  • Thanks, good point. I'll set it up like that on my next project:) Commented Dec 29, 2024 at 12:14
3

A week ago i started facing the same issue it seems like Vercel doesn't offer collaboration in the Free Tier anymore. There are 2 solutions to this problem :

  1. Simply buy a pro plan for $20 dollars.
  2. git config user.email "email" (of vercel account linked) DRAWBACK: Although git config solution is a workaround, but all commits will appear under the linked Vercel account.
3

I had that problem and found a good solution that doesn't need the 'git config user.email' approach. So your commits will still be under your own Github account and count for your statistics.

You need to add the Deploy Hook URL to GitHub:

  1. In Vercel's Project go to → Settings → Git → Deploy Hooks
  2. Create a hook with any name you want, and in the main branch
  3. Copy the URL
  4. Go to GitHub's Repository and then to → Settings → Webhooks → Add webhook 5. Paste the URL you copied 6. Select Content type: application/json 7. Select "Just the push event" 8. Select Enable SSL verification
  5. Add webhook

Now your Vercel deployments will start automatically when you push to your repository's main.

3
  • Does the push event include merging a PR within GitHub website interface? Or it only means literally calling git push from the Terminal?
    – ADTC
    Commented Dec 28, 2024 at 15:44
  • To answer my own question, yes it applies to PR merges in GitHub website as well. However, I'm inferring that we're likely going to end up with a lot of deployments from the same tip commit in main branch because of doing this and that in the repo. I think to avoid it, I will have to change "Just the push event" to "Let me select individual events." > check "Branch or tag deletion" (and uncheck "Pushes") so that I will only trigger it by deleting the PR branch. I wish I could fine-grain control the events sent so I could only trigger it for "Pull request closed" but that's not possible.
    – ADTC
    Commented Dec 28, 2024 at 15:53
  • Also, I have enabled "Automatically delete head branches (After pull requests are merged)" in the repo settings, so that the branch will be automatically deleted when the PR is merged, and that will trigger the deployment. (Note: My use case is different from the original question use case. I only need to squash-merge pull requests (PR) from others who aren't on Vercel and still trigger deployments without adding them as Vercel users.)
    – ADTC
    Commented Dec 28, 2024 at 16:52
2

Click on the Details Link that is appearing below on the error. It will redirect you to a vercel page requesting access. If your vercel account is logged in, it will automatically give you access.

You should then make a change in code and push it. Your vercel will be working now.

0

A non scalable solution (it's de facto not a ci/cd) is to create a meaningless commit in the repo from the Vercel git owner. I personally did it directly from the git web console just to update the project.

Main drawbacks:

  • it's not a ci/cd
  • it creates a lot of "garbage" commits

Main advantages:

  • no need for the paid tier
  • it doesn't require any setup to trigger a deployment
0

I didn't see this answer mentioned but this is what worked for me:

  • Click on user profile icon in top right corner
  • Click "Account Settings"
  • Go to "Authentication"
  • Add your Github account as authentication
  • Log out
  • Log back in to Vercel using this github account

Then deployment works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.