You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10执行make init-dev时Git Clone SSH报错求助

Git Clone SSH Fails in Make Script (Windows 10) but Works Directly – Fix for Hostname Semicolon Issue

Let’s break down why this is happening and walk through the fixes:

Root Cause

Your problem boils down to two Windows-specific environment quirks:

  1. Misinterpreted SSH URL: The URL in your script uses git@gitlab.com:/goodcommerce/goodcommerce-hydra.git – that extra slash after the colon is unnecessary for GitLab SSH URLs. When make runs via Windows’ default CMD shell, this :/ gets mangled into ;c (CMD treats the colon+slash as a command separator combined with your system drive letter), resulting in the invalid hostname gitlab.com;c.
  2. Shell Mismatch: When you run git clone directly, you’re probably using a POSIX-compatible shell like Git Bash or WSL, which handles Git’s SSH syntax correctly. But make on Windows defaults to CMD, which doesn’t understand POSIX shell logic or Git URL formatting the same way.

Step-by-Step Fixes

1. Correct the Git SSH URL

First, fix the URL in your make init-dev script to use the proper GitLab SSH format (remove the leading slash after the colon):

if [ ! -d "goodcommerce-hydra" ] ; then 
  git clone "git@gitlab.com:goodcommerce/goodcommerce-hydra.git" "goodcommerce-hydra"; 
  cd goodcommerce-hydra && git checkout "master"; 
fi

2. Force make to Use a POSIX-Compatible Shell

To ensure make uses a shell that handles your script correctly, add this line at the top of your Makefile:

SHELL := $(shell which bash)

If which bash doesn’t resolve (common in some Windows setups), hardcode the path to Git Bash’s executable (adjust the path if your Git installation is in a different location):

SHELL := C:/Program\ Files/Git/bin/bash.exe

Verify the Fix

After making these changes, run make init-dev again – it should clone the repository without the hostname error, matching the behavior when you run the git clone command directly.

内容的提问来源于stack exchange,提问作者andres martinez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 11:52:27