Templar-von-Midgard / git-credential-kwallet

Git credential helper for KWallet
MIT License
16 stars 9 forks source link

git does not use this helper #1

Open chiraganand opened 4 years ago

chiraganand commented 4 years ago

I compiled and installed the helper in /usr/loca/bin/git-credential-kwallet and configured ~/.gitconfig with:

[credential]
    helper = kwallet

If I do git fetch on any of the repositories, git asks me to enter username/password on command line. I was assuming kwallet will ask for username and password.

Thanks for creating this helper, it is very much needed.

real-yfprojects commented 3 years ago

Git will use git-credential as a proxy for asking the credential helper for data for the given remote. If the helper can't provide a username. Git (actually git-credential) will personally ask for one. After that Git will ask the helper again but with the extra information of a username. If the helper can't provide a password. Git will personally ask for a password. If the gathered credentials are correct, that is working, git-credential will tell the helper to store exactly these credentials. If the gathered credentials aren't working, git will tell the helper to erase the credentials.

sl1pkn07 commented 3 years ago

Hi. same here

but fdor me, if run git-credential-kwallet --debug <acction> do nothing. stuck in console for long time and do nothing

how i can trace what happens?

greetings

real-yfprojects commented 3 years ago

but fdor me, if run git-credential-kwallet --debug <acction> do nothing. stuck in console for long time and do nothing

Please explain what exactly you entered in the terminal.

Also explain what the problem was in the first place leading you to try to debug the credential helper.

I can also recommend reading the git credential docs or other resources how the git credential protocol actually works. This will help you understand most issues.

sl1pkn07 commented 3 years ago

Hi. What comand? 'get', 'store', 'erase'.... None of that actions do nothig (for example, create a entry in my wallet with the credential stored), for that, i include '--debug', which also no get any type of ouput in console. So i can't see what happen or what doing the program, like how interact with git if retreive/send information to any local/remote credential server

Greetings

real-yfprojects commented 3 years ago

As explained in this article git credential helpers wait for input on stdin (standard in stream) after calling them with an action specified. Try to run:

> git-credential-kwallet store

you should be able to enter the following in the terminal:

protocol=https
host=example.com
username=bob
password=s3cre7

Hit enter.

After that the entered credential should appear in kwallet.

sl1pkn07 commented 3 years ago

nope., my wallet (configured with --wallet <name>) still have no entry with thing about gi-credentials or something when paste your code (for example) and hit enter

Templar-von-Midgard commented 3 years ago

Hi. Did you actually close the standard input stream after entering the details? Try out the following:

git-credential-kwallet --debug store <<EOF
protocol=https
host=example.com
username=bob
password=s3cre7
EOF
sl1pkn07 commented 3 years ago

yea. whit that now works (idk how close the imput stream by hand)

git-credential-kwallet: operation: "store" wallet: "kdewallet" folder: "git" protocol: "https" host: "example.com" username: "bob"
kf.windowsystem: Cannot use KWindowSystem without a QGuiApplication

and spawn a window with dialog for select the wallet store method

then unless is a missing thing. i think this should be added in the readme or something for avoid "problems"

thanks for the help

greetings

Templar-von-Midgard commented 3 years ago

I guess, I will add a disclaimer in the readme, that:

git-credential-kwallet is a git credential helper, it is meant to be invoked by git, not manually.

If you run into issue, then be sure to close the input stream. e.g.:

git-credential-kwallet --debug store <<EOF
protocol=https
host=example.com
username=bob
password=s3cre7
EOF

Btw, you should be able to press CTRL+D on a blank line to send an EOF and that should close the standard input stream.

edit: typo

sl1pkn07 commented 3 years ago

thanks for the ctrl+d tip (years in linux and this is the first case i need use it xd)

greetings