ネットワークエンジニアのアレ

技術情報メインの備忘系ブログです

【Git】git cloneで403 Forbiddenが出てCloneできない

非公開リポジトリへのgit cloneで403 ForbiddenエラーがでてCloneできなかったのでメモ。

エラーの内容

# git clone https://github.com/hoge/hogehoge.git
Initialized empty Git repository in /root/PALallax/.git/
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/hoge/hogehoge.git/info/refs

fatal: HTTP request failed   

環境は以下

# cat /etc/redhat-release
CentOS release 6.6 (Final)

# git version
git version 1.7.1

回避策

URLの先頭に「gitアカウント@」を追加します。
コマンド実行後にgitパスワードの入力を求められるので入力することで、git cloneできます。

# git clone https://hoge@github.com/hoge/hogehoge.git