Skip to content

remote: Repository not found. #2210

Open
@kvaghasia

Description

@kvaghasia

Hello,

I am trying to setup mirroring repo from Github A to Github B. Setting up action workflow to run when repo in GitHub A is updated.

Below is workflow code :
`name: Mirror to GitHub B

on:
push:
branches:
- '**'

permissions:
actions: write
checks: write
pull-requests: write
contents: read
packages: write

jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Check write access to target repo
run: |
set -e
echo "::add-mask::${{ secrets.GITHUB_B_ORG_TOKEN }}"
git clone --bare https://${{ secrets.GITHUB_B_USERNAME }}:${{ secrets.GITHUB_B_ORG_TOKEN }}@github.com/${{ secrets.GITHUB_B_ORG }}/${{ secrets.GITHUB_B_REPO_NAME }}.git test-repo
cd test-repo
# Try to create a dummy ref and push it (will fail if no write access)
git update-ref refs/heads/__test_write_access HEAD
if git push origin refs/heads/__test_write_access; then
echo "Write access confirmed."
git push origin --delete refs/heads/__test_write_access
else
echo "No write access to the target repository."
exit 1
fi
- name: Checkout test-mirror branch from GitHub A
uses: actions/checkout@v4
with:
ref: test-mirror
fetch-depth: 0

  - name: Push test-mirror branch to GitHub B
    run: |
      echo "::add-mask::${{ secrets.GITHUB_B_ORG_TOKEN }}"
      git remote add mirror https://${{ secrets.GITHUB_B_USERNAME }}:${{ secrets.GITHUB_B_ORG_TOKEN }}@github.com/${{ secrets.GITHUB_B_ORG }}/${{ secrets.GITHUB_B_REPO_NAME }}.git
      git ls-remote mirror
      git push mirror test-mirror:test-mirror`

"name: Check write access to target repo" step is running successfully but "name: Push test-mirror branch to GitHub B" is failing to run with following error

Run echo "::add-mask::"
echo "::add-mask::
"
git remote add mirror github.com//.git
git ls-remote mirror
git push mirror test-mirror:test-mirror
shell: /usr/bin/bash -e {0}
##[debug]/usr/bin/bash -e /home/runner/work/_temp/f2779388-7c6d-4160-966d-f1e92796a589.sh
::add-mask::

remote: Repository not found.
fatal: repository 'https://github.com/***/***.git/' not found
Error: Process completed with exit code 128.

Can someone help me here setting up mirror.

Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions