GitLab で clone や fetch ができなくてハマった

結論

パーミッションに決まってるでしょ……。

f:id:gregminster:20180326164425p:plain

状況

Jenkins で GitLab から git clone しようとしたところ、以下のようなエラーが出て大ハマりしました。

 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitaddress/repository.git/'

認証関係かなあと思って URL にユーザ名とパスワードを埋め込んでみたり*1、Jenkins の認証設定をいじったりしたんですが、まあ GitLab 側の Permission が原因でした*2

トークンを使えば必ずしも Public にしなくても大丈夫なようです。

参考ページ

*1:テスト以外ではこれをやるのはやめましょう

*2:よくある話

Powered by はてなブログ