Try passing ssh key via git command line argument. #105
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitLab Mirror | |
on: | |
- push | |
- delete | |
permissions: | |
contents: read | |
env: | |
TARGET_REPO: [email protected]:meedan/pender.git | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
name: Git Repo Sync | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup credentials | |
run: | | |
mkdir ~/.ssh | |
echo $SSH_PRIVATE_KEY > ~/.ssh/id | |
chmod 600 ~/.ssh/id | |
git config core.sshCommand 'ssh -i ~/.ssh/id' | |
- name: Sync push | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
git -c "core.sshCommand=ssh -i ~/.ssh/id" remote add target $TARGET_REPO | |
git -c "core.sshCommand=ssh -i ~/.ssh/id" push -f --all target | |
git -c "core.sshCommand=ssh -i ~/.ssh/id" push -f --tags target | |
- name: Sync delete | |
if: ${{ github.event_name == 'delete' }} | |
run: | | |
git -c "core.sshCommand=ssh -i ~/.ssh/id" remote add target $TARGET_REPO | |
git -c "core.sshCommand=ssh -i ~/.ssh/id" push -d target ${GITHUB_EVENT_REF} |