startalks

スマホアプリ(Android/iOS)、IoT、AI、データサイエンス

【Github】fatal: Authentication failed for ‘https://・・・’対処法

▼事象

Git cloneコマンド実行時に以下エラーが発生する。

エラー例)

fatal: Authentication failed for ‘https://・・・’

コマンド例)

git clone https://github.com:username/projectname.git

 

▼対処法

①gitconfigを確認する

 cat ~/.gitconfig

設定されていないのであれば以下コマンドで設定する

git config --global user.name <user name>

git config --global user.password <user password>

 

②公開鍵を作成する

$cd ~/.ssh

$ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/(username)/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

 

pbcopy < ~/.ssh/id_rsa.pub

 

③公開鍵をGithubに上げる

https://github.com/settings/ssh

 

④成功したことを確認

ssh -T git@github.com

->succsess

 

⑤以下コマンドでClone

git clone git@github.com:username/projectname.git