在带有 Mavericks 的 mac mini 上,当我尝试从私有 git 服务器进行 git clone 时,我遇到了身份验证问题。我已经使用同一台服务器在 Windows 和 Ubuntu 上安装和配置了 git 几次,之前没有出现过此类问题。我不知道下一步该尝试什么。
症状:
git clone https://username@git.example.com:8448/git/libs/project.git
Cloning into 'project' ...
Password for 'https://username@git.example.com:8448': [1] note
fatal: Authentication failed for 'https://username@git.example.com:8448/git/libs/project.git'
[1] 在其他系统上没有要求我这样做。我相信我已经将我的 git 客户端配置为不要求输入密码。我提供的没有密码好在这个提示
我的 ~/.gitconfig 中有这个:
[http]
sslKey = /Users/macuser/auth/username.key
sslCert = /Users/macuser/auth/username.pem
sslVerify = false
[user]
name = username
email = username@example.com
设置客户端证书时,我收到了以下文件,这些文件放在名为 ~/auth 的文件夹中:
username.cer
username.p12
username.pem
ca.cer
我运行了这个命令来生成密钥文件:
openssl rsa -in /Users/macuser/auth/username.pem -out /Users/macuser/auth/username.key
然后我运行了 git config 命令,例如:
git config --global http.sslKey /Users/macuser/auth/username.key
git config --global http.sslCert /Users/macuser/auth/username.pem
git config --global http.sslVerify false
像上面的步骤一样配置 git 后,在其他系统上,当我执行“git clone https”时,它就可以工作了。在安装了 Xcode 命令行工具的 OS X Mavericks 上,git 无法进行身份验证。
我究竟做错了什么?
提前致谢。
编辑:
我想我会添加这条信息。服务器正在使用自签名证书,或者来自没有权威的证书。这就是我将 http.sslVerify 设置为 false 的原因。
这是详细的克隆命令。Linux 和 Mac 上的设置是相同的,除了 auth 文件夹位置。Linux 版本成功,而 Mac 版本失败。
http://cache.codebot.org/stackoverflow/linux-git-works.txt
http://cache.codebot.org/stackoverflow/mac-git-fails.txt
回答:
sudo port install git-core