passforios icon indicating copy to clipboard operation
passforios copied to clipboard

Error on remote push: Invalid packet line

Open tapesonthefloor opened this issue 5 years ago • 12 comments

Version: Pass for iOS 0.5.0 (8) Protocol: https Software: Gitea Auth method: password

Error:

Push upload to remote failed Underlying error: invalid packet line

tapesonthefloor avatar Aug 27 '18 16:08 tapesonthefloor

It seems like you saw this message when you were pushing your commits?

Are you able to clone your repo?

yishilin14 avatar Aug 28 '18 04:08 yishilin14

Same problem for me via SSH. Am able to clone but can't push. Maybe something wrong with my git setup?

lyleberman avatar Aug 31 '18 11:08 lyleberman

Hey, @lyleberman: Is there any chance you're pushing to a Gitea or Gogs instance?

tapesonthefloor avatar Sep 06 '18 02:09 tapesonthefloor

No, just a pass git running on a Mac.

lyleberman avatar Sep 06 '18 10:09 lyleberman

Do you guys have any suggestions about how to reproduce this issue in the easiest way?

I think I should install Gitea/Gogs... Haven't tried before... May I have your, say, setup?

But I kind of feel that I can do nothing about this issue. It is most likely that some features are not supported by ObjectiveGit. Its homepage says Not all libgit2 features are available, but if you run across something missing, please consider contributing a pull request!

yishilin14 avatar Sep 06 '18 12:09 yishilin14

I honestly can't say, @yishilin14. Though I've suddenly had an issue with this same repo when pushing from the command line (pre-receive hook declined), so if I can isolate that issue it might elucidate things here, too. Thanks for responding either way.

@lyleberman: Where are you hosting your pw repo?

tapesonthefloor avatar Sep 06 '18 17:09 tapesonthefloor

I get the same error on my laptop. I set up my pass directory (~/.password-store) and setup git. Then I opened the passforios app, imported the PGP keys. Then I went to the "Password Repository" tab in Settings and entered the repository url like this: ssh://[email protected]/home/username/.password-store/ I entered my username below and left the authentication method on Password. When I tap on "Clone", I entered the password of my user.

Everything works fine. It clones my passwords from my git repo like it should. The only problem is creating new passwords in the app itself. When I try to sync after creating a password, I get the

"Error:

Push upload to remote failed Underlying error: invalid packet line"

message. So there has to be something wrong in the git push.

Would love to see this fixed. Amazing app apart from that.

ghost avatar Sep 12 '18 13:09 ghost

I have the same problem as @avoc9 with same config... Such a great app, even if I can't update pass in the app for the moment. :-)

tyjak avatar Sep 12 '18 17:09 tyjak

i setup with: pass init && pass git init

my git url is: ssh://me@home/home/me/.password-store

i'm using an ssh key (aside: ssh key had no password, but i was still prompted for one).

the version of git on home is 2.19.2 and pass is v1.7.3.

i'm able to clone and receive new passwords created with pass on home.

i get the "invalid packet line" when trying to push new passwords created from passforios.

the underlying error for me is from git-receive-pack and reads:

error: refusing to update checked out branch: refs/heads/master error: By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent with what you pushed, and will require 'git reset --hard' to match the work tree to HEAD.

You can set the 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into its current branch; however, this is not recommended unless you arranged to update its work tree to match what you pushed in some other way.

To squelch this message and still keep the default behaviour, set 'receive.denyCurrentBranch' configuration variable to 'refuse'. unpack ok

this is apparently causing some sort of parse error, maybe in libgit2.

a workaround is: pass git config receive.denyCurrentBranch ignore

however, the problem with this workaround is that pass from the command-line now requires pass git reset --hard HEAD before it will see changes made from the app. in fact, a reset is needed before you can generate a new pass from the command-line or pass will delete changes made by the app.

i'm curious if people have been successful using pass and passforios with the same clone. i'm guessing that i'm doing it wrong (it was so easy) by making pass & passforios share the same clone of the password repository.

i expect the appropriate solution is to have a repository that both pass and passforios separately clone.

two things passforios could do

  • not prompt for a password for an ssh key that does not have one
  • warn a user if their repo url ends in .password-store and suggest they not use pass's clone

mattf avatar Jan 04 '19 15:01 mattf

I think this is not a problem with passforios or a missing feature in ObjectiveGit. It is just Git refusing to push to a checked out branch, which makes sense in general. Working with pass every change in the repository is directly committed, given the user does not change and commit files manually. So, the work tree is always clean. Git allows to push to checked out branches with a clean work tree by setting the option receive.denyCurrentBranch updateInstead. See the documentation for more information.

I have not tried that out since I normally use a separate bare repository for synchronisation purposes. It would be nice if someone could test with the mentioned option.

SimplyDanny avatar Jan 04 '19 19:01 SimplyDanny

Shouldn't this issue be closed ?

wazdra avatar Nov 11 '20 08:11 wazdra

The solution I found is the same as @SimplyDanny (a separate bar repo for passforio sync) so there's no real issue here, just some more configuration to have things setup well...

tyjak avatar Nov 11 '20 18:11 tyjak