@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

gitコマンドでGitHubにアクセスするユーザーを切り替える

user.name ではなく、 credential.username を設定しておけばGitHubに接続する時のユーザー名を指定できる。

git config credential.username peccu

osxkeychainを使っている場合は別のリポジトリを使うときに使った設定が引き継がれて、こんなエラーを吐く。(superuserより)

remote: Permission to username1/repo.git denied to username2.
fatal: unable to access 'https://github.com/username1/repo.git/': The requested URL returned error: 403

superuser.com

Acceptedじゃない回答が求めていたものだった。