状況
- GitHubのアカウントがいくつかある
- デフォルトで使っているものと違うアカウントのリポジトリなので
git config
でユーザー名とメールアドレスを変えた - 初プッシュ
remote: Permission to jigen098/hoge.git denied to fuga.
解決策
git remote -v
で出てくるURLにユーザー名つける
origin https://github.com/jigen098/hoge.git (fetch)
origin https://github.com/jigen098/hoge.git (push)
このURLのgithub.comの前に下の例みたいにユーザー名つける
git remote set-url origin https://jigen098@github.com/jigen098/hoge.git