1. 以管理员身份运行上面的powershell 命令修改openssh 服务的默认shell 为bash
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force

来源参考 <https://stackoverflow.com/questions/53834304/how-do-i-git-clone-from-a-windows-machine-over-ssh>

  • 2. 添加 C:\Program Files\Git\mingw64\bin 到系统环境变量Path 列表里
  • 3. 修改 C:\programdata\ssh\ 目录里的配置文件,比如administrators_authorized_keys和sshd_config。修改端口到2023 或者其他你喜欢的端口。将管理员SSH 公钥添加到administrators_authorized_keys中。普通用户的公钥在C:\Users\cwyyprog\.ssh\authorized_keys 文件里。
  • 4. 在C盘下创建GIT目录和其下面的MyFirstGitRepo目录,并运行git init 初始化一个GIT仓库。
cd MyFirstGitRepo
git init
  • 5.在其他机器上运行如下命令,克隆刚才建立的那个仓库

git clone ssh://[administrator@1.2.3.4:2023]/C/GIT/MyFirstGitRepo

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据