2
3

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.

gitlabにてURLにユーザを含めているにも関わらず、403エラーでpushできない

Posted at

問題

git cloneでほかの人(AAA)の作ったレポジトリをクローンしてきて、変更をかけてpushしようとすると、以下のように失敗。

git push origin master
remote: Access denied
fatal: unable to access 'http://KI1208@<IP>/AAA/repository.git/': The requested URL returned error: 403

上記レポジトリはpublicで公開されており、上記のURLやブランチ自体にはwebからアクセスして閲覧は可能。(そもそもgit cloneも可能だった。)

原因

Webからファイルを置こうとすると、権限不足で失敗するため、権限不足と判断。
20171212_168.jpg
image

対応

rootでログインして、adminのページを開く。
image

Settings→Membersから自分をDeveloper権限で追加
20171212_165.jpg

これでもう一度pushするとOK。

git push origin master
Counting objects: 1202, done.

もちろん、通常はrootの情報なんてもっていないはずなので、管理者の方に連絡する必要がありますね。

補足

同じ条件で調べると、異なるユーザ情報でログインしてしまっているケースが多かった。
解決策としては、以下のコマンドで、remote serverのURLに自分のユーザ名(USERNAME)を含めるというもの。
git remote set-url origin https://USERNAME@github.com/AAA/repository.git

たぶん自分のケースはより初歩的なので、それゆえにはまる人もいるかもしれない。

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?