I am trying to automatically synchronize my GitHub repository with the Adobe Cloud Manager Git repository, so that my Cloud Manager pipeline always has the latest source code. I created a GitHub Action to push changes from main, develop, and other branches whenever there’s a commit. However, my push keeps failing with the error:
remote: pre-receive hook declined
remote: You are not allowed to update refs/heads/develop
Here’s the GitHub Action I am using:
name: Mirror to Adobe Cloud Manager
on:
push:
branches:
- main
- develop
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AEM_CLOUD_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan git.cloudmanager.adobe.com >> ~/.ssh/known_hosts
- name: Add Adobe remote
run: |
git remote add adobe ${{ secrets.AEM_CLOUD_REPO_URL }}
- name: Push changes
run: |
git push --mirror adobe
When I run this, the pipeline fails at the last step. I also have multiple branches like develop/develop and develop/qa. Could this be the issue? Is --mirror the wrong approach when pushing to Cloud Manager? How should I correctly push my branches and tags from GitHub to the Adobe repository?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @MartinSm4,
I think it is rejecting because git push --mirror attempts to push all references, including refs/pull/* and other internal refs that Cloud Manager doesn’t allow. Adobe Cloud Manager has strict pre-receive hooks that only accept refs/heads/* (branches) and refs/tags/* (tags). The error you facing usually means either the key being used doesn’t have write permissions or the branch structure you are pushing is invalid.
Instead of --mirror, you should explicitly push only branches and tags. Try this to fix your GitHub Action:
name: Mirror to Adobe Cloud Manager
on:
push:
branches:
- main
- develop
- 'develop/**'
- 'release/**'
- 'hotfix/**'
tags:
- '*'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
tags: true
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AEM_CLOUD_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan git.cloudmanager.adobe.com >> ~/.ssh/known_hosts
- name: Add Adobe remote
run: |
git remote add adobe ${{ secrets.AEM_CLOUD_REPO_URL }}
git config remote.adobe.push '+refs/heads/*:refs/heads/*'
git config --add remote.adobe.push '+refs/tags/*:refs/tags/*'
- name: Push branches and tags
run: |
git push adobe --prune --atomic
git push adobe --prune --tags
Hi @MartinSm4,
I think it is rejecting because git push --mirror attempts to push all references, including refs/pull/* and other internal refs that Cloud Manager doesn’t allow. Adobe Cloud Manager has strict pre-receive hooks that only accept refs/heads/* (branches) and refs/tags/* (tags). The error you facing usually means either the key being used doesn’t have write permissions or the branch structure you are pushing is invalid.
Instead of --mirror, you should explicitly push only branches and tags. Try this to fix your GitHub Action:
name: Mirror to Adobe Cloud Manager
on:
push:
branches:
- main
- develop
- 'develop/**'
- 'release/**'
- 'hotfix/**'
tags:
- '*'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
tags: true
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AEM_CLOUD_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan git.cloudmanager.adobe.com >> ~/.ssh/known_hosts
- name: Add Adobe remote
run: |
git remote add adobe ${{ secrets.AEM_CLOUD_REPO_URL }}
git config remote.adobe.push '+refs/heads/*:refs/heads/*'
git config --add remote.adobe.push '+refs/tags/*:refs/tags/*'
- name: Push branches and tags
run: |
git push adobe --prune --atomic
git push adobe --prune --tags
Views
Likes
Replies