fugafuga.write

日々のログ

git push で 403 エラー

403 エラーが出て困るの巻

SSH Key を github に新たに登録して初めて git push するときに以下のエラーが出た。

$ git push origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/tokoyax/dotfiles.git/info/refs

fatal: HTTP request failed

対策は以下の通り、

# vim ./.git/config
 [remote "origin"]
    …
    url = https://github.com/tokoyax/dotfiles.git
    
    ↓ github.com の前にユーザー名@ をつける
    
    url = https://tokoyax@github.com/tokoyax/dotfiles.git

もう一度 git push を行うと、パスワードを聞かれるので入力するとうまくいきました。