工作开始使用Azure DevOps,并且我试图在我的家用计算机上克隆存储库。我创建了一个ssh密钥,将其添加到密钥列表中,并将git config更改为我的工作电子邮件。但是,天青仍然要求输入密码...
(base) Name-MacBook-Pro:Company Name$ git clone git@ssh.dev.azure.com:v3/Company/AI/Repo
Cloning into 'Repo'...
Enter passphrase for key '/Users/Name/.ssh/id_rsa':
git@ssh.dev.azure.com's password:
Permission denied, please try again.
git@ssh.dev.azure.com's password:
git@ssh.dev.azure.com: Permission denied (password,publickey).
____________ edit ________________
试图再次生成,但我仍然遇到麻烦
创建新的ssh密钥
ssh-keygen -t rsa -b 4096 -C“ work@email.com”-f〜/ .ssh / work_id_rsa
复制
cat〜/ .ssh / work_id_rsa | pbcopy
添加到组织并尝试克隆
ssh-agent bash -c'ssh-add〜/ .ssh / work_id_rsa; git clone https://company@dev.azure.com/Repo'
Cloning into 'Repo'...
Password for 'https://company@dev.azure.com':
fatal: Authentication failed for 'https://comapny@dev.azure.com/Repo'
答案 0 :(得分:1)
如果这是可能由ourside(Microsoft)引起的问题。我再次尝试使用SSH克隆及其成功:
此问题应由您的SSH密钥格式引起。由于我不清楚您使用哪种方法来生成密钥,但是在您的问题中,这应该是因为公钥身份验证失败,所以它要求您提供帐户密码。
确保您的私钥具有以下格式:
var prod = (from t in _context.Product
group t by t.ProductAbbr
into g
select new
{
Id = (from t2 in g select t2.Id).Max()
}).ToList();
// int idlist = Int32.Parse(prod);
var request = (from p in _context.Product
where(p => prod.Contains(p.Id))
select new
{
p.Id, p.ProductAbbr
}).ToList().Distinct();
如果没有,请使用以下命令重新生成:
-----BEGIN RSA PRIVATE KEY-----
*
*
*
-----END RSA PRIVATE KEY-----
然后将公共密钥配置到组织中。
答案 1 :(得分:0)
生成密钥的方法实际上很好(OpenSSH),并且我的subset <- lapply(runVars, function(x){
paste0("histyears", x$numberOfHistroicalYears, "_hcc", as.integer(x$calculateHCC),
"_histcut", as.integer(x$historyCutOff), "_", x$cutOffTime, "m_", x$calculationType)
})
上有多个SSH密钥,因此我认为这也没有关系。使用 same 算法,可能最多只能有一个键。
我认为实际的问题是密钥名称。
您使用过:
.ssh
很棒(大量字节:)
,但是在测试连接时将永远找不到“ work_id_rsa”,例如:
ssh-keygen -t rsa -b 4096 -C “work@email.com” - f ~/.ssh/work_id_rsa
为了测试,我重命名并删除了我的。
简而言之,结果如下:
ssh -v git@ssh.dev.azure.com
因此,实际上OpenSSH将永远找不到它。我的意思是,我没有在其中放置pires@avell:~$ ssh -v git@ssh.dev.azure.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to ssh.dev.azure.com [51.144.61.32] port 22.
debug1: Connection established.
(removed for brevity)
debug1: Authenticating to ssh.dev.azure.com:22 as 'git'
(removed for brevity)
debug1: Host 'ssh.dev.azure.com' is known and matches the RSA host key.
debug1: Found key in /home/pires/.ssh/known_hosts:3
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
(((((important detail here:)))))
debug1: Will attempt key: /home/pires/.ssh/id_rsa
debug1: Will attempt key: /home/pires/.ssh/id_dsa
debug1: Will attempt key: /home/pires/.ssh/id_ecdsa
debug1: Will attempt key: /home/pires/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/pires/.ssh/id_ed25519 ED25519 SHA256: *************
debug1: Will attempt key: /home/pires/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/pires/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pires/.ssh/id_rsa
debug1: Trying private key: /home/pires/.ssh/id_dsa
debug1: Trying private key: /home/pires/.ssh/id_ecdsa
debug1: Trying private key: /home/pires/.ssh/id_ecdsa_sk
debug1: Offering public key: /home/pires/.ssh/id_ed25519 ED25519 SHA256:************
(((((and here:)))))
debug1: Authentications that can continue: password,publickey
debug1: Trying private key: /home/pires/.ssh/id_ed25519_sk
debug1: Trying private key: /home/pires/.ssh/id_xmss
debug1: Next authentication method: password
git@ssh.dev.azure.com's password:
,但这没关系,因为它不会在文件夹中查找所有内容,对于您而言,它希望work_id_rsa
恰好在此。或者更好的是,/home/pires/.ssh/id_rsa
指向+ ~
此外,由于找不到私钥进行身份验证,因此它会退回到密码。