(setq auth-sources '("~/.authinfo"))
(auth-source-forget-all-cached)
(defun get-env-var (name)
"Safely get the value of an environment variable."
(let ((value (getenv name)))
(if value
value
(message "Environment variable %s not set" name)
nil)))
(defun get-password (key)
"Retrieve a password from the Unix password manager 'pass'."
(let ((password (shell-command-to-string (concat "pass " key))))
(if (string-match-p "^gpg:" password)
(progn
(message "Failed to retrieve password for %s" key)
nil)
(string-trim password))))
(use-package ghub)
(with-eval-after-load 'tramp
(ghub-request "GET" "/user" nil
:forge 'github
:host "api.github.com"
:username "jwalsh"
:auth 'forge))