40
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub リポジトリに git push したら Permission が denied

Last updated at Posted at 2017-02-10

よく知られていることかもしれませんが,自分への備忘録として書いておきます.

GitHub (アカウント hoge) でリポジトリ ("abc") 作成: hoge/abc

GitHub で以下のように提示されるとおり

echo "# abc" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/hobe/abc.git
git push -u origin master

git push すると

$ git push origin master
remote: Permission to hoge/abc.git denied to fuga.
fatal: unable to access 'https://github.com/hoge/abc.git/': The requested URL returned error: 403

ローカル側に何らかの理由で fuga という別アカウントが紐付いている?

取り急ぎ解決策として

$ git remote set-url origin https://hoge@github.com/hoge/abc.git
$ git push origin master
Password for 'https://hoge@github.com': 

パスワード入れると無事に push されました(^^)

40
34
2

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
40
34

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?