【Sourcetree】 Clone(クローン)したとき、「 SSL certificate problem」エラーの対処方法
Sourcetreeでリモートリポジトリからmaster(マスター)ブランチをローカルにクローンしようとしたときに、エラー: fatal: unable to access ‘https://xxx.com/xxx/git/xxx/xxx.git/’: SSL certificate problem: unable to get local issuer certificateが発生してハマったので、対処方法を掲載
環境
GitBucket 4.2.0
接続先:https://xxxx.com/gitbucket/git/xxxx/admin.git(正規証明書)
エラー画面

原因は、デフォルトでGitは「SSL証明書の検証をしない」(注意:セキュリティ的に危険があります)が無効となっているため、SSL証明書エラーが発生してクローンできなかった。
ツールをクリックし、メニューからオプションを選択します。

Gitタブをクリックし、「SSL証明書の検証をしない」(注意:セキュリティ的に危険があります)にチェックを入れて検証をしないを有効にします。
終わったら、OKボタンを押します。


クローンしてみる。Cloneボタンをクリックします。

Cloneするために、リモートアカウント(https://xxxx.com/gitbucket/git/xxxx/xxx.git)を設定します。

「credentialHelperSelector」が表示されます。これは認証情報(ユーザ名、パスワード)が必要となるので、それを毎回入力しなくても良いように助けて(ヘルプ)くれる機能です。
- <no helper> → helperを使わない 。 毎回ユーザ名、パスワードを入力する。
- <cache>→認証情報が一定の間だけメモリーに記憶されます。 パスワードはディスクには保存されません。15分経つとメモリーから除去されます。
- <manager> → Git Credential Manager for Windowsを使う。Windowsの資格情報に暗号化されローカルディスクに保存されます。
- <store> → git-credential-storeを使う。有効期限なしのパスワードを平文でローカルディスクに保存
- <wincred> → git-credential-wincredを使う。Windowsの資格情報に暗号化されローカルディスクに保存されます。
一般的には「manager」を選択して、リモートホストへのログインIDとパスワードを入力します。
毎回、同じ設定を使用する場合は、「always use this from now on」にチェックします。
「fatal: destination path ‘ ’ already exists and is not an empty directory.」とエラーが発生した場合は、指定したフォルダが空になっていないことが原因です。隠しフォルダで.gitなどが存在しているケースがあります。
usernameとpasswordを入力します。

無事クローンできました。
