git-crypt unlock doesn't recognize my GPG key (workaround described)
- Langage dominant
- C++
- Étoiles
- 9.9k
- Forks
- 544
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
My workflow:
1. I generated a GPG key pair on my laptop (macOS High Sierra) and exported the private key to a second computer.
2. On the second computer (Ubuntu 18.04), I ran the following commands (git-crypt version 0.6.0 is installed on both machines):
```
git-crypt init
git-crypt add-gpg-user
```
3. I created and committed a .gitattributes file.
4. I created and committed a test file that matched the .gitattributes file.
5. I pushed the resulting branch to GitHub.
6. Returning to my laptop, I fetched and checked out the branch, then attempted to run:
```
git-crypt unlock
```
The result:
```
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'.
```
I found the key that was generated by `git-crypt add-gpg-user` and was able to manually decrypt it with `gpg --decrypt < .git-crypt/keys/default/0/FOOBAR.gpg`, where FOOBAR.gpg is the name of the file that was generated. This gave me the symmetric key that is supposed to be automatically handled by the tool.
The following workaround is therefore possible:
```
#!/bin/sh
#
# git-crypt-unlock - Work around a bug in git-crypt.
#
# This will unlock the repo even though git-crypt can't do it. May not be
# as secure as git-crypt's correct implementation would be.
umask 077
for FILE in `find .git-crypt/keys/default -type f`; do
if gpg --decrypt < $FILE > git-crypt-symmetric-key; then
git-crypt unlock git-crypt-symmetric-key
rm -f git-crypt-symmetric-key
exit 0
fi
done
```
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.