Skip to content

pre-receive hook declined when pushing to a protected branch from actions #34567

Open
@joelvc98

Description

@joelvc98

Description

I have my master branch protected, allowing to push a created user gitea-bot.
When i do the push manually from terminal, it works perfectly.
Also if i remove the branch protection, it works.
But when the push is done in the actions, i receive this error:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'xxxx'.

And in the gitea logs i see this:
Unable to GetUserByID for commits from 3b07e51fed0c26572f0131285fb3e948a612 to 83eb83ef99e46b195911c0f3d518aeead2e4 in <Repository 190:xxxx>: user does not exist [uid: -2, name: ]

I created a token for the user also, in the actions i am doing the push like that:
- name: Configure Git user
run: |
git config --global user.name "gitea-bot"
git config --global user.email "[email protected]"

  - name: Generate version
    run: |
      npm version ${{ github.event.inputs.VERSIONADOR || 'patch' }}
      git remote set-url origin https://gitea-bot:${{ secrets.GITEABOT_TOKEN }}@xxxx
      git remote -v
      git push origin master
      git push --tags

I don`t undestand why the user does not exist here.

Gitea Version

1.23.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

The gitea is running in docker in a remote system

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detailtype/questionIssue needs no code to be fixed, only a description on how to fix it yourself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions