Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing the project to gitlab prompts “! [remote reject] origin/HEAD -> HEAD (pre-receive hook rejected)” #34

Open
fscarmen opened this issue Jan 26, 2025 · 8 comments

Comments

@fscarmen
Copy link

fscarmen commented Jan 26, 2025

I've been using this program to mirror my repositories to Gitlab for several years now and it's always worked fine. However, in the last week, namely, the following error was reported.

log:

Run pixta-dev/repository-mirroring-action@v[1](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:1).1.1
  with:
    target_repo_url: [email protected]:fscarmen/sing-box.git
    ssh_private_key: ***
    ssh_username: git
/usr/bin/docker run --name d5cd38c1[2](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:2)1a810084cb[3](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:3)ab4fa33e7d752d94_03f583 --label 66d5cd --workdir /github/workspace --rm -e "INPUT_TARGET_REPO_URL" -e "INPUT_SSH_PRIVATE_KEY" -e "INPUT_SSH_USERNAME" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/sing-box/sing-box":"/github/workspace" 66d5cd:38c121a81008[4](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:4)cb3ab4fa33e7d752d94
OpenSSH_8.1p1, OpenSSL 1.1.1k  2[5](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:5) Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gitlab.com [172.[6](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:7)5.251.78] port 22.
debug1: Connection established.
debug1: identity file /github/home/.ssh/id_rsa type -1
debug1: identity file /github/home/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version GitLab-SSHD
debug1: no match: GitLab-SSHD
debug1: Authenticating to gitlab.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /github/home/.ssh/id_rsa  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss>
debug1: kex_input_ext_info: [email protected] (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /github/home/.ssh/id_rsa
debug1: Authentication succeeded (publickey).
Authenticated to gitlab.com ([1[7](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:8)2.65.251.78]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending command: git-receive-pack 'fscarmen/sing-box.git'
remote: GitLab: You cannot create a branch with an invalid name.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 2576, received 1936 bytes, in 0.4 seconds
Bytes per second: sent 7142.2, received 5367.[8](https://github.com/fscarmen/sing-box/actions/runs/12978052211/job/36192180233#step:4:9)
debug1: Exit status 0
To gitlab.com:fscarmen/sing-box.git
 ! [remote rejected] origin/HEAD -> HEAD (pre-receive hook declined)
error: failed to push some refs to '[email protected]:fscarmen/sing-box.git'

My action yml:

name: GitHub Actions Mirror

on:
  workflow_dispatch:
  schedule:
    - cron: '15 20 * * *'

jobs:
  mirror_to_gitlab:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/[email protected]
        with:
          fetch-depth: 0
      - name: 'Mirror to gitlab'
        uses: pixta-dev/[email protected]
        with:
          target_repo_url:
            [email protected]:${{ github.repository }}.git
          ssh_private_key:
            ${{ secrets.PRIVATE_KEY }}
Image
@fpsampayo
Copy link

Same error here!

@adintegra
Copy link

Started running into this same error just a few days ago too (after being stable for years). Action yml:

name: xxxxxxxxx

on: [push, delete]

jobs:
  to_gitlab:
    runs-on: ubuntu-latest
    steps: # <-- must use actions/checkout@v4 before mirroring!
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: pixta-dev/repository-mirroring-action@v1
        with:
          target_repo_url: xxxxxxxxx
          ssh_private_key: # <-- use 'secrets' to pass credential information.
            ${{ secrets.KEY }}

@killajoe
Copy link

killajoe commented Feb 4, 2025

remote: GitLab: You cannot create a branch with an invalid name.

could this be related? Gitlab may changed GitLab's naming conventions?

@killajoe
Copy link

killajoe commented Feb 6, 2025

To me it looks like this repo is not maintained anymore?
Any alternative?

@fscarmen
Copy link
Author

fscarmen commented Feb 6, 2025

Can you tell me about any similar programs?

@killajoe
Copy link

killajoe commented Feb 6, 2025

@fscarmen
Copy link
Author

fscarmen commented Feb 6, 2025

uses: fscarmen/[email protected]

I have fixed it myself. Fix error when mirroring original project to Github “! `[remote rejected] origin/HEAD -> HEAD (pre-receive hook rejected)”.

Image Image

@adintegra
Copy link

We switched to https://github.com/wearerequired/git-mirror-action. Similar approach as @fscarmen implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants