我有以下内容,我需要在 Windows 终端命令提示符或 linux 中克隆存储库。
我试过:
git clone git@xxxxx.com:xxx/xxx/git
Run Code Online (Sandbox Code Playgroud)
我得到
Permission denied(public key)
Couldn't read from remote repository
Run Code Online (Sandbox Code Playgroud)
还尝试将 URL 更改为:
git clone https://xxxxx.com:xxx/xxx/git
Run Code Online (Sandbox Code Playgroud)
Wis*_*ell 89
总是迟到回答任何问题,您可能有多个 ssh 密钥,如果未指定,git 将尝试使用,id_rsa但如果您需要不同的密钥,您可以使用
git clone git@provider.com:userName/projectName.git --config core.sshCommand="ssh -i ~/location/to/private_ssh_key"
Run Code Online (Sandbox Code Playgroud)
这样,它将应用此配置并使用与id_rsa从 git 存储库实际获取任何数据之前不同的密钥。
随后fetch或push将使用指定的密钥对克隆的存储库进行身份验证。
希望这对任何人都有帮助。
Ala*_*ALI 31
我建议您按照以下步骤操作:
$> ls -al ~/.ssh
你看到任何名为id_rsa和的文件id_rsa.pub吗?
如果是,请转到步骤 3
如果没有,您需要生成它们
$> ssh-keygen -t rsa -b 4096 -C "yourEmail"
将您的 SSH 密钥添加到 ssh-agent
$> eval "$(ssh-agent -s)"
$> ssh-add ~/.ssh/id_rsa
获取您的公钥
$> cat ~/.ssh/id_rsa.pub
转到您的 GIT 项目 -> 设置 -> SSH 密钥
然后在 SSH 密钥中传递您的公钥内容
当您无法在 Git 帐户上设置密钥时,这是一种替代解决方案
$> sudo nano ~/.ssh/config
然后改变这一行
IdentityFile <yourPrivateKey>
$> git clone git@xxxxx.com:xxx/xxx/git
在命令行中运行ssh -T git@github.com
(参见https://help.github.com/articles/testing-your-ssh-connection/)
如果可行,接下来请使用 git。但可能会有,是你的问题。
克隆,然后使用 git clone git@github.com:$USERNAME/$REPONAME.git
| 归档时间: |
|
| 查看次数: |
61052 次 |
| 最近记录: |