Skip to content

Try passing ssh key via git command line argument. #105

Try passing ssh key via git command line argument.

Try passing ssh key via git command line argument. #105

Workflow file for this run

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}