Skip to content

Commit

Permalink
Add helper scripts to make Git GPG signing work in Codespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lumaxis committed Jan 13, 2023
1 parent e8c69bf commit b64dd4b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ Many thanks to the [dotfiles community](https://dotfiles.github.io).

These files are licensed under the [MIT license](./licenses/MIT) except the following files which are taken from [Mike McQuaid](https://github.com/MikeMcQuaid/dotfiles) and are licensed under the [GPLv3 license](./licenses/GPLv3):

- [bin/git-credential-dotfiles](./bin/git-credential-dotfiles)
- [bin/git-gpg-dotfiles](./bin/git-gpg-dotfiles)
- [bin/touchid-enable-pam-sudo](./bin/touchid-enable-pam-sudo)
14 changes: 14 additions & 0 deletions bin/git-credential-dotfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Source: https://github.com/MikeMcQuaid/dotfiles
# Use the right credential helper on Codespaces/macOS/Linux
set -e

if [[ "$CODESPACES" == "true" ]]
then
/.codespaces/bin/gitcredential_github.sh "$@"
elif [[ "$(uname -s)" == "Darwin" ]]
then
git credential-osxkeychain "$@"
else
git credential-cache "$@"
fi
11 changes: 11 additions & 0 deletions bin/git-gpg-dotfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Source: https://github.com/MikeMcQuaid/dotfiles
# Use the right GPG helper on Codespaces
set -e

if [[ "$CODESPACES" == "true" ]]
then
/.codespaces/bin/gh-gpgsign "$@"
else
gpg "$@"
fi
8 changes: 6 additions & 2 deletions config/git/config
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[user]
name = Lukas Spieß
email = [email protected]
signingkey = 9C9B7EC4E32DDDE12135366518488BCD4C52C648

[includeIf "gitdir/i:~/Developer/Work/"]
path = ./work/config
Expand All @@ -17,6 +16,10 @@
autocrlf = input
trustctime = false

[credential]
# Use custom dotfiles credentials helper.
helper = dotfiles

[init]
defaultBranch = main
templatedir = ~/.config/git/template
Expand All @@ -28,7 +31,8 @@
gpgsign = true

[gpg]
program = gpg
# Use custom dotfiles GPG helper that automatically handles GitHub Codespaces.
program = git-gpg-dotfiles

[fetch]
prune = true
Expand Down

0 comments on commit b64dd4b

Please sign in to comment.