AGWA / git-crypt

Transparent file encryption in git
https://www.agwa.name/projects/git-crypt/
GNU General Public License v3.0
8.18k stars 475 forks source link

Can't git-crypt unlock because of no GPG secret key available #135

Closed winmasta closed 6 years ago

winmasta commented 6 years ago

I have created GPG keypair with gpg --gen-key

# gpg --list-keys
/root/.gnupg/pubring.gpg
---------------------------------
pub   4096R/D1A6A7BC 2017-10-25
uid                  ha
sub   4096R/5E78130D 2017-10-25

I have exported this key to a file and put it to another machine.

gpg --armor --export --output pubkey.gpg D1A6A7BC

I have imported this key on another machine.

gpg --import pubkey.gpg

It was imported.

# gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub   4096R/D1A6A7BC 2017-10-25
uid                  ha
sub   4096R/5E78130D 2017-10-25

On local machine I have executed

git-crypt init

in the project folder, then executed

git-crypt add-gpg-user --trusted ha

to add public key to my git repo.

On another machine I have cloned my repo requred branch. Then I have tried to git-crypt unlock and I have got an error

Error: no GPG secret key available to unlock this repository.
To unlock with a shared symmetric key instead, specify the path to the symmetric key as an argument to 'git-crypt unlock'.

What I did wrong ?

winmasta commented 6 years ago

There is some files in .gitattributes file and when I made git push from local machine those files are encrypted.

winmasta commented 6 years ago

The problem was that I have aexported private key but should export secret one.

keironstoddart commented 6 years ago

Had the same problem, thanks for tracking this down.

balsoft commented 4 years ago

What if I don't have my secret key at all (it was generated on a yubikey and I only have my public key)? It worked fine on the main machine, but doesn't work on my laptop for some reason.