[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to understand variable configuration #1

Closed
phillamb168 opened this issue Nov 12, 2019 · 1 comment
Closed

Trying to understand variable configuration #1

phillamb168 opened this issue Nov 12, 2019 · 1 comment

Comments

@phillamb168
Copy link
phillamb168 commented Nov 12, 2019

Hi, here's a snippet of my implementation of this action:
- name: repo-sync
uses: wei/git-sync@v1
env:
SOURCE_REPO: "git@github.com:hopeonesource/hopeonesource.org.git"
SOURCE_BRANCH: ${ GITHUB_REF:11 }
DESTINATION_REPO: "codeserver.dev.[redacted]@codeserver.dev.[redacted].drush.in:2222/~/repository.git"
DESTINATION_BRANCH: ${ GITHUB_REF:11 }
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_PANTHEON_REMOTE }}
with:
args: $SOURCE_REPO $SOURCE_BRANCH $DESTINATION_REPO $DESTINATION_BRANCH

The secret exists, however I am getting both a Permission Denied (public key) message as well as the following:

SOURCE=git@github.com:repo/repo.git:${
DESTINATION=git@github.com:GITHUB_REF:11.git:}
Warning: Permanently added 'github.com,140.82.114.4' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: src refspec ${ does not match any
error: failed to push some refs to 'git@github.com:GITHUB_REF:11.git'
##[error]Docker run failed with exit code 1

What am I doing wrong? It's tough to find documentation on how env vars are supposed to be referenced.

@rasodu
Copy link
Contributor
rasodu commented Dec 31, 2019

Both, source and destination, repositories are synced over SSH protocols. Currently you are only allowed to add a single SSH_PRIVATE_KEY. So, you are trying to use the same private key to read repo from github and to push repo to codeserver. You have got a few options to fix this.

  1. Add your public key to "Deploy key" on your Github project.
  2. Use this as your source: https://$GITHUB_TOKEN@github.com/hopeonesource/hopeonesource.org.git <- I haven't tried this. So, not hundred percent sure that this will work as is. May be there is a few more changes that you would need.
  3. Create a pull request that will allow using two different keys. One for source repo and second for destination repo.

Let us know what was final solution.

@wei wei closed this as completed Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants