Skip to content

Bug: sam init - CalledProcessError #7929

@odxkamimoto

Description

@odxkamimoto

Description:

sam init --location git+ssh://git@github.com/my_org/my_repo.git failed with the following error.

2025-03-11 15:59:50 git clone failed with error: Cloning into 'odx-eq-lambda-aws-sam-python'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Steps to reproduce:

  1. Create github repository and template with following structure:
❯ tree
.
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cookiecutter.json
├── hooks
│   └── post_gen_project
└── {{cookiecutter.project_name}}
    ├── Makefile
    ├── Pipfile
    ├── README.md
    ├── buildspec.yaml
    ├── events
    │   └── testevent.json
    ├── function
    │   ├── __init__.py
    │   └── requirements.txt
    ├── samconfig.toml
    ├── template.yaml
    └── tests
        ├── __init__.py
        ├── conftest.py
        └── unit
            ├── __init__.py
            └── test_hello_function.py
			
  1. Run the command 'sam init --location git+ssh://git@github.com/my_org/my_repo.git'

Observed result:

2025-03-11 15:45:20 git clone failed with error: Cloning into 'my_repo'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Error: Command '['git', 'clone', 'ssh://git@github.com/my_org/my_repo.git']' returned non-zero exit status 128.
Traceback:
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "samcli/commands/init/command.py", line 103, in wrapped
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 783, in invoke
File "samcli/lib/telemetry/metric.py", line 185, in wrapped
File "samcli/lib/telemetry/metric.py", line 150, in wrapped
File "samcli/lib/utils/version_checker.py", line 43, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/init/command.py", line 266, in cli
File "samcli/commands/init/command.py", line 347, in do_cli
File "samcli/commands/init/init_generator.py", line 24, in do_generate
File "samcli/lib/init/init.py", line 112, in generate_project
File "cookiecutter/main.py", line 80, in cookiecutter
File "cookiecutter/repository.py", line 108, in determine_repo_dir
File "cookiecutter/vcs.py", line 105, in clone
File "subprocess.py", line 466, in check_output
File "subprocess.py", line 571, in run

An unexpected error was encountered while executing "sam init".
Search for an existing issue:

Expected result:

sam init completes successfully and the project directory is created.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 22.04(wsl)
  2. sam --version: SAM CLI, version 1.134.0
  3. AWS region: ap-northeast-1
# Paste the output of `sam --info` here

{
"version": "1.134.0",
"system": {
"python": "3.11.10",
"os": "Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35"
},
"additional_dependencies": {
"docker_engine": "27.5.1",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}

Add --debug flag to command you are running

Same as the above results.

We have also confirmed that we can successfully clone from GitHub with the following command.

git clone git+ssh://git@github.com/my_org/my_repo.git

Also, the project is successfully created from CodeCommit's repository with the same contents.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions