Skip to content
New issue

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

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

Already on GitHub? # to your account

how to unlock git crypt in github actions workflow? #288

Open
ninetynin opened this issue Apr 23, 2023 · 1 comment
Open

how to unlock git crypt in github actions workflow? #288

ninetynin opened this issue Apr 23, 2023 · 1 comment

Comments

@ninetynin
Copy link

https://github.com/ninetynin/temp-test-repo/actions/runs/4774573308/jobs/8488344079

Run git-crypt unlock
git-crypt: Error: Unable to open key file - have you unlocked/initialized this repository yet?
error: external filter '"git-crypt" clean' failed [1](https://github.com/ninetynin/temp-test-repo/actions/runs/4774573308/jobs/8488344079#step:10:1)
error: external filter '"git-crypt" clean' failed
fatal: session.json: clean filter 'git-crypt' failed
git-crypt: Error: 'git status' failed - is this a Git repository?
Error: Process completed with exit code 1.

this is a sample github action how to support git-crypt unlock here
because 1. if i use git-crypt add-gpg-user im getting this err

git-crypt add-gpg-user action@git
hub.com
gpg: error reading key: No public key
Error: public key for 'action@github.com' not found in your GPG keyring
  1. even if i have a symmetric key i still cant upload it on github so i cant use the path to unlock...
@randofan
Copy link

randofan commented Sep 17, 2024

Hi there, I'm running into the same issue. Did you ever find a workaround?

Edit: in case anyone is running into this issue, I ended up creating a symmetric key and converting the binary into base64. Then, I copied this as an actions secret and unlocked it in the action itself.

Get the key in base64:

base64 /path/to/key

Actions step:

 - name: Unlock git-crypt
        run: |
          sudo apt-get update
          sudo apt-get install -y git-crypt
          echo ${{ secrets.GIT_CRYPT_KEY }} | base64 -d | git-crypt unlock -

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants