We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

vrafaeli@msn.com • 6 years ago

Where is the documentation for git-credential-libsecret. I want it to match my credentials with the full repo name, not just the host of the repo. As I have several github.com repositories I need to access with different credentials.

tometchy • 6 years ago

As announced in previous comment I tried it, but before I will tell you what I've investigated, quick tip, maybe it will satisfy you - you can set push access to every of those repos to one account and use this account in credential manager - https://help.github.com/en/...
That's what I do with GitLab repos which I don't own but maintain :)

I tried to achieve exactly what you expected, but didn't success.
First I tried to rename github.com server to github.com/user/repo but then credential manager didn't match it.
Adding two entries with the same hostname didn't work as well.
Libsecret credential manger uses org.gnome.keyring.NetworkPassword schema so I checked if there are any additional fields, and found one - "char *object; Share or other object on server." - https://developer.gnome.org... but passing value "github.com/user/repo" or "/user/repo" or "user/repo" to "object" key didn't work too.

To be honest I don't event know if Git passes whole repo url to credential manager. Probably it doesn't as fetch address can be different than push address, it would need to pass both of them.
If it does, then libsecret credential manager could be extended to achive this.

The only solution, which comes to my mind right now, to achieve what you asked, is to use some DNS trick or proxy service. So you will save via libsecret two servers "githubA", and "githubB" both pointing to "github.com".

But if you have permission to add collaborators to repo I will go this way :)

vrafaeli@msn.com • 6 years ago

Thanks for a quick reply. It is a bit advanced discussion for me. :) I must use different accounts for different repos. If I find something I will come back.

tometchy • 6 years ago

No problem :)

I tried DNS trick, but Git didn't get fooled. Maybe some proxy server will do the trick for you. Here is what I did:

Added github ip to /etc/hosts file as githuba.com
140.82.118.4 githuba.com

Cloned repo with skipping ssl veryfication (due to certificate not matching hostname)
git -c http.sslVerify=false clone http://githuba.com/user/repo

Configured this repo to skip ssl verify with every command (but only this repo, not glbally)
git config http.sslVerify false

Saved credentials as githuba.com server
secret-tool store --label='Git: http://githuba.com' xdg:schema org.gnome.keyring.NetworkPassword server githuba.com user tometchy protocol http

But despite git sees remote as githuba:
git remote -v
origin http://githuba.com/user/repo (fetch)
origin http://githuba.com/user/repo (push)

Asking for credentials is for correct github address (not matching githuba)
git fetch
Username for 'https://github.com': [...]

vrafaeli@msn.com • 6 years ago

yes. doing hacks is not what I would like as a solution. Probably the git itself should be improved to account for that.

tometchy • 6 years ago

Hi vrafaeli@msn.com , interesting question. Libsecret itself is just a library, which unifies and simplifies access to Secret Service Api.
Official repo is on GitHub - https://github.com/GNOME/li... and documentation is on gnome wiki - https://wiki.gnome.org/Proj...
As this is a library, you don't use it for managing passwords as a user - for this purpose you can use Seahorse tool.
I've never tried to use different credentials for the same repo hosting - I will try to accomplish this and let you know if I was able :)

vrafaeli@msn.com • 6 years ago

Cool. Thanks

rogerdpack • 6 years ago

Why would a package require you to build something post facto?

tometchy • 6 years ago

Hi rogerdpack, thanks for your comment.

Good question - it's because makefile to build credential manager based on libsecret is there already after git installation:

/usr/share/doc/git/contrib/credential/libsecret$ ls
git-credential-libsecret.c Makefile

But it requires libsecret as dependencies, so make command without installing libsecret-1-0 and libsecret-1-dev first won't success:
/usr/share/doc/git/contrib/credential/libsecret$ sudo make
Package libsecret-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecret-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsecret-1' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package libsecret-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecret-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsecret-1' found

So packages you install are just general dependencies to build credential manager :)