fix(ci): use authenticated remote URL for gitea git ops
This commit is contained in:
parent
096be08d63
commit
9eb1b55a64
1 changed files with 5 additions and 4 deletions
9
.github/workflows/sync-to-gitea.yml
vendored
9
.github/workflows/sync-to-gitea.yml
vendored
|
|
@ -41,15 +41,16 @@ jobs:
|
|||
fi
|
||||
TARGET="https://ci.nxtgauge.com/Admin/${REPO}.git"
|
||||
AUTH="$(printf '%s' "${GITEA_USER}:${GITEA_TOKEN}" | base64 | tr -d '\n')"
|
||||
AUTH_URL="https://${GITEA_USER}:${GITEA_TOKEN}@ci.nxtgauge.com/Admin/${REPO}.git"
|
||||
|
||||
echo "Using Gitea user: ${GITEA_USER}"
|
||||
echo "Sync target: Admin/${REPO}.git"
|
||||
|
||||
curl -fsS -H "Authorization: Basic ${AUTH}" "${TARGET}/info/refs?service=git-receive-pack" >/dev/null
|
||||
git -c http.extraheader="Authorization: Basic ${AUTH}" ls-remote "${TARGET}" >/dev/null
|
||||
git ls-remote "${AUTH_URL}" >/dev/null
|
||||
|
||||
git remote remove gitea 2>/dev/null || true
|
||||
git remote add gitea "${TARGET}"
|
||||
git remote add gitea "${AUTH_URL}"
|
||||
|
||||
git -c http.extraheader="Authorization: Basic ${AUTH}" push gitea "HEAD:${BRANCH}" --force
|
||||
git -c http.extraheader="Authorization: Basic ${AUTH}" push gitea --tags --force
|
||||
git push gitea "HEAD:${BRANCH}" --force
|
||||
git push gitea --tags --force
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue