Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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

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 されました(^^)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした