LoginSignup
0
0

More than 3 years have passed since last update.

git 忘却録

Posted at

問題 pushしたいが403が出てしまう場合

例えば

git clone https://github.com/{ユーザ名}/{レポジトリー名}.git
cd {レポジトリー名}
echo "# {レポジトリー名}" >> README.md
git add README.md
git commit -m "first commit"
git push -u origin master

みたいなことをした場合、以下のエラーがでてしまうことがあります

remote: Permission to {ユーザ名}/{レポジトリー名}.git denied to xxxx.
fatal: unable to access 'https://github.com/{ユーザ名}/{レポジトリー名}.git/': The requested URL returned error: 403

対処方法

ドメイン部分の先頭に「{ユーザ名}@」を入れるのがコツです。そうすると対話形式でパスワードを確認してくるので、パスワードを認証することができます。

git remote set-url origin https://{ユーザ名}@github.com/{ユーザ名}/{レポジトリー名}.git
git push -u origin master

成功!
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0