I'd like to configure magit so that it does not prompt me for my GitHub username when it needs to interact with GitHub in some way (like, say, when doing a push).
My GitHub username is already in the github.user
elisp variable and git variable, which should be enough according to the ghub documentation, but for some reason it keeps prompting me for my username every time I push.
magit gets my password from an external program which prompts me for my gpg key password which is used to decrypt my GitHub password in pass, and that part works fine.
I also have forge set up to use pass, and when using forge functions from magit I'm not prompted for my username, and only prompted for my gpg key password which decrypts my GitHub password in the same way it does for magit. So if forge could be set up not to prompt for my username, I'd expect there should be some way to configure magit act the same.
Here is my setup:
In my emacs config:
(require 'auth-source-pass)
(setq auth-sources '(password-store))
(add-hook 'magit-process-find-password-functions
'magit-process-password-auth-source))
(setq github.user "myusername")
From a shell, I typed:
git config --global github.user myusername
So now my ~/.gitconfig
contains:
[github]
user = myusername
My ~/.password-store
directory tree looks like this:
.
├── api.github.com
│ └── myusername^forge.gpg
└── github.com
└── myusername.gpg
I also tried sticking ^magit
after myusername
and putting both of these variations under api.github.com
, like the forge entry was, but that didn't help.