git 的默认登录名

git 的默认登录名

如何在 Windows 7 上设置 git 的默认登录名?当我运行 时git clone ssh://<server>/repo,git 会尝试连接到user@<server>,其中user是我的 Windows 用户名。如何更改给定服务器的默认用户名?我无法使用ssh://<username>@<server>/repo

答案1

对于 ssh 连接,您可以指定:

  • 服务器
  • 名字
  • 私钥

例子:

Host server
User yourLogin
Hostname SSH IP address --eg 192.68.24.1
IdentityFile "path to your private ssh key"

在名为的文件中config(在您的下HOME/.ssh,假设您定义了HOME环境变量,该变量在 Windows 中默认未定义)。

请参阅“ 中更完整的示例”使用 ssh 将 nbgit 连接到远程主机“。

相关内容