timvisee / prs

🔐 A secure, fast & convenient password manager CLI using GPG and git to sync.
https://gitlab.com/timvisee/prs
GNU General Public License v3.0
211 stars 8 forks source link

Git issues: multiple remote, exit status: 128 and completion #17

Open Pantamis opened 1 year ago

Pantamis commented 1 year ago

Hi !

I am always following your great project !

The problem I had with git was that I used keygrip instead of long ID in .gpg-id file, prs seems to not be able to handle them. Manually replacing keygrip with key ID allows prs to recognize recipients. Great :+1:

Now I still have some issues:

  1. I use multiple remote with custom name. It seems prs can't handle them:

prs sync remote error: multiple remotes configured, cannot decide automatically

What should I do ?

  1. Even if now git recognizes the recipient, it seems I mostly can't use it For exemple, when I want to edit a secret using prs edit [secret_path] --verbose it returns me:

error: git operation exited with non-zero status code: exit status: 128

If I have uncommited change, the previous command is able to warn me about it and stop. I have no issue to decrypt a file with gpg with prs show. Also, my ssh key are stored with gpg too so I always have to set gpg agent using export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) before doing any git related stuff. Maybe it is not supported by prs ?

  1. Bash completion not working as expected

I did prs internal completion bash this allows me to complete using tabs but it only propose me the file in the current folder. I have to cd into password-store directory to be able to complete with secrets' names.

Thanks for your time :)

timvisee commented 1 year ago

I am always following your great project !

Awesome! :innocent:

  1. I use multiple remote with custom name. It seems prs can't handle them:

Could you elaborate on how you use this? That would help me understand how this can be properly implemented. Do you always push to all your remotes for example?

For basic synchronization prs assumes you have a single remote that it can push to. With multiple remotes things get complicated on whether prs should push to it or not.

I can minimize errors here, for example, to just use the tracked remote for the current branch (git config branch.master.remote), but this is limited.

Please note that prs sync remote [URL] just gets and sets the primary remote. If this errors, you may resolve this manually with prs git remote instead.

I've added an issue for some improvements on this here.

2. Even if now git recognizes the recipient, it seems I mostly can't use it For exemple, when I want to edit a secret using prs edit [secret_path] --verbose it returns me:

I'm not sure what you mean by this. Could this be related to a GPG key that is used for signing commits, that isn't found or unlocked?

Does running prs sync give you the same error?

This issue works on improving git's output in --verbose mode.

Also, my ssh key are stored with gpg too so I always have to set gpg agent using export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) before doing any git related stuff. Maybe it is not supported by prs ?

Yes, exported environment variables are used by git. prs simply uses the git binary, so there's no real magic here.

3. Bash completion not working as expected

Fixed in ac55961072cd8a02705125041a22e052981fd998.

~That's weird! This was implemented by #12 as shown here: https://github.com/timvisee/prs/pull/12/files~

~I've added an issue to re-implement this here.~


Thank you for these reports. These are super useful!