@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

AWSのSAMでテンプレートを落とす時に失敗したのでgitで証明書のエラーを無視したら成功した

tl;dr;

$ git config --global http.sslVerify false

正しいCACertsがあるならこちら(未確認)

$ git config --system http.sslCAPath /path/to/cacerts

流れ

sam initの途中で走るgit cloneSSL証明書の問題で失敗してしまった。 エラーメッセージがややこしかったので記録。

MINGW64環境で証明書更新する方法がわかってない。。。

エラー時のログ

$ sam init

        SAM CLI now collects telemetry to better understand customer needs.

        You can OPT OUT and disable telemetry collection by setting the
        environment variable SAM_CLI_TELEMETRY=0 in your shell.
        Thanks for your help!

        Learn More: https://docs.aws.amazon.com/sercerless-application-model/latest/developerguide/server-less-sam-telemetry.html

Which template source would you like to use?
        1 - AWS Quick Start Templates
        2 - Custom Template Location
Choice: 1

Which runtime would you like to use?
        1 - nodejs12.x
        2 - python3.8
        3 - ruby2.7
        4 - go1.x
        5 - java11
        6 - dotnetcore3.1
        7 - nodejs10.x
        8 - python3.7
        9 - python3.6
        10 - python2.7
        11 - ruby2.5
        12 - java8.al2
        13 - java8
        14 - dotnetcore2.1
Runtime: 2

Project name [sam-app]:

Cloning app templates from https://github.com/awslabs/aws-sam-cli-app-templates.git

------------------------
Generating application:
------------------------
Name: sam-app
Runtime: python3.8
Dependency Manager: pip
Application Template: hello-world
Output Directory: .

Next steps can be found in the README file at ./sam-app/README.md

Error: Please verify your location. The following types of location are supported:

* Github: gh:user/repo (or) https://github.com/user/repo (or) git@github.com:user/repo.git
          For Git repositories, you must use location of the root of the repository.

* Mercurial: hg+ssh://hg@bitbucket.org/repo

* Http(s): https://example.com/code.zip

* Local Path: /path/to/code.zip

試しに↑のリポジトリをクローンしたらSSLのエラー

$ git clone https://github.com/awslabs/aws-sam-cli-app-templates.git sam-app
Cloning into 'sam-app'...
fatal: unable to access 'https://github.com/awslabs/aws-sam-cli-app-templates.git/': SSL certificate problem: self signed certificate in certificate chain

これを適当に調べて設定で無視

$ git config --global http.sslVerify false

cf.

confluence.atlassian.com

これでsam initを再実行したらテンプレートを落としてくるところまでうまくいった。