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

1Password commit signing, with multiple git accounts. #5592

Open
oathlesss opened this issue Feb 5, 2025 · 1 comment
Open

1Password commit signing, with multiple git accounts. #5592

oathlesss opened this issue Feb 5, 2025 · 1 comment
Labels
🐛bug Something isn't working

Comments

@oathlesss
Copy link

Description

I use 1Password as my ssh-agent and it is managing two git accounts. But my commits aren't signed.

Steps to Reproduce the Problem

  1. Have two git accounts configured as follows:
    global .gitconfig

    [user]
      name = Personal Account
      email = [email protected]
      signingkey = ssh-ed25519 .......
    
    [gpg]
      format = ssh
    
    [gpg "ssh"]
      program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
    
    [commit]
      gpgsign = true
    
    [core]
      editor = nvim
    
    [ui]
      editor = "nvim"
    
    [includeIf "gitdir:~/projects/work/"]
      path = ~/projects/work/.gitconfig
    

    .gitconfig work folder

    [user]
      name = Work Account
      email = [email protected]
      signingkey = ssh-ed25519 .......
    
    [gpg]
      format = ssh
    
    [gpg "ssh"]
      program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
    
    [commit]
      gpgsign = true
    

    jj config.toml:

    [ui]
    default-command = "log"
    paginate = "never"
    
    [git]
    subprocess = true
    
    # Tried following but sadly no result:
    # [signing]
    # sign-all = true
    # backend = "ssh"
    # Work signingkey was used as I only need work commits to be signed.
    # signingkey = "ssh-ed25519 ......"
    #
    # [signing.backends.ssh]
    # program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
    
  2. Open project: (~/projects/work/project-i-am-making-changes-in/)

  3. jj describe -m "test"

  4. jj new

  5. touch test-change

  6. jj squash

  7. jj git push

Expected Behavior

I expect the new change to be pushed.

Actual Behavior

I get the following error:

❯ jj git push
Changes to push to origin:
  Move sideways bookmark <bookmark-name> from ..... to .....
remote: GitLab: Commit must be signed with a GPG key

Specifications

If any additional info is needed for debugging please let me know and I will provide it as best as I can!

@oathlesss
Copy link
Author

Some additional info I found while debugging:

jj describe -m "test"
jj bookmark set <bookmark-name>
git switch <bookmark-name>
git log --show-signature

According to the git log --show-signature my "test" commit has been signed.

❯ jj git push --debug
2025-02-05T13:09:26.245689Z  INFO jj_cli::cli_util: debug logging enabled
2025-02-05T13:09:26.252617Z DEBUG globset: glob converted to regex: Glob { glob: "src/celerybeat-schedule.*", re: "(?-u)^src/celerybeat\\-schedule\\.[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([Literal('s'), Literal('r'), Literal('c'), Literal('/'), Literal('c'), Literal('e'), Literal('l'), Literal('e'), Literal('r'), Literal('y'), Literal('b'), Literal('e'), Literal('a'), Literal('t'), Literal('-'), Literal('s'), Literal('c'), Literal('h'), Literal('e'), Literal('d'), Literal('u'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-05T13:09:26.252640Z DEBUG globset: built glob set; 10 literals, 19 basenames, 5 extensions, 0 prefixes, 0 suffixes, 1 required extensions, 1 regexes
2025-02-05T13:09:26.253347Z DEBUG globset: glob converted to regex: Glob { glob: "**/*", re: "(?-u)^(?:/?|.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, ZeroOrMore]) }
2025-02-05T13:09:26.253367Z DEBUG globset: built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes
Changes to push to origin:
  Move sideways bookmark <bookmark-name> from e3cb6f7e21ef to b47e7a191353
2025-02-05T13:09:26.257558Z DEBUG run_command: jj_lib::git_subprocess: spawning a git subprocess cmd="git" "--bare" "--git-dir" "/Users/user/projects/work/project/.git" "push" "--porcelain" "--force-with-lease=refs/heads/<bookmark-name>:e3cb6f7e21ef90257f412494e38c6a1641d7bd7b" "--" "origin" "b47e7a19135380893f2257208ef326511de9fabf:refs/heads/<bookmark-name>"
remote: GitLab: Commit must be signed with a GPG key
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/<bookmark-name>
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.

@PhilipMetzger PhilipMetzger added the 🐛bug Something isn't working label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants