git-up / GitUp

The Git interface you've been missing all your life has finally arrived.
http://gitup.co
GNU General Public License v3.0
11.44k stars 1.23k forks source link

Saving credentials for https or using macOS keychain not working? #1000

Closed craftey closed 1 month ago

craftey commented 1 month ago

I recently tried to push with GitUp. It asks me for creds but never saves them. My git cli uses macOS keychain to save and use my credentials, which works fine. I also tried ~/.git-credentials without success. I am trying to connect to gitlab.com via https and with username and a repo token generated in my gitlab profile. It seems to work with the auth dialog but it asks me on every action.

So how can I get GitUp.app to not ask for credentials?

Thanks for any idea you might have. Kindly, craftey

Cykelero commented 1 month ago

Weird! GitUp is indeed supposed to remember your credentials. It's supposed to save these in the macOS keychain. Could you check if they're getting created at all?

Open Keychain Access.app, and search for gitlab.com. You should get at least one entry. Of these entries, at least one of them should have GitUp in its allowlist:

image

craftey commented 1 month ago

Thank you very much for your "works for me" comment. With that I looked a bit closer into my Keychain Access.app. I recently had to update my gitlab token, because they enforce a token expiry policy now ☹️. Anyway in the process of updating my token I somehow got two entries for "gitlab.com", the new one and the old one. In this situation git-up asks for creds again and again.

After deleting the old entry, git-up works normally. It asks once to access the existing keychain entry where I was able to "always allow" to read the keychain entry. This adds Git-up to the allow list in the new keychain entry, done. Git-up does not ask for creds anymore, as desired.

Cykelero commented 1 month ago

Awesome! Glad you found the fix.

If I recall correctly, when GitUp queries the keychain, it only requests a single item; my guess is that it would always retrieve the older, incorrect one. Those credentials wouldn't work for authenticating, so the app would proceed to ask for new credentials. Saving them back to the keychain had no effect because the item was already there, simply ignored during the query.