You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用SSH从dev.azure.com克隆Git突然要求输入密码的求助

Troubleshooting SSH Password Prompt for Azure DevOps Git

Hey there, let's figure out why your Azure DevOps Git over SSH is suddenly asking for a password when it worked fine weeks ago. Looking at your SSH and Git configs, here are the most likely fixes to try step by step:

1. Fix Your SSH Config Matching

Right now, your SSH config has a Host azure entry pointing to ssh.dev.azure.com, but when you run git clone git@ssh.dev.azure.com:v3/oranization/project/repo, SSH isn't using that azure host alias—so it won't automatically pick up the id_openshift_tst_rsa key you specified. You have two options here:

Option A: Use the Host Alias for Cloning

Update your clone command to use the azure alias you defined:

git clone git@azure:v3/oranization/project/repo

Option B: Update SSH Config to Match the Exact Hostname

Modify your SSH config so the Host entry matches ssh.dev.azure.com directly, ensuring SSH uses your key for all connections to that domain:

Host ssh.dev.azure.com
  IdentityFile ~/.ssh/id_openshift_tst_rsa
  IdentitiesOnly yes  # Uncomment this line to force using only this key

Pro tip: Uncommenting IdentitiesOnly yes is a good idea—it prevents SSH from trying other keys (like your id_rsa for Bitbucket) which can cause authentication conflicts.

2. Verify Your SSH Key is Loaded in the Agent

Even if your config is correct, if your private key isn't loaded into the SSH agent, Azure DevOps might fall back to password authentication. Check if your key is loaded:

ssh-add -l

If you don't see the fingerprint for id_openshift_tst_rsa, load it manually:

ssh-add ~/.ssh/id_openshift_tst_rsa

Note: If this works temporarily but resets after a reboot, you can add the key to your shell's startup script (like ~/.bashrc or ~/.zshrc) to load it automatically.

3. Test the SSH Connection Directly

Run a verbose SSH test to see exactly what's happening during authentication. This will show if your key is being offered and accepted:

ssh -v git@ssh.dev.azure.com

Look for lines like:

debug1: Offering public key: ~/.ssh/id_openshift_tst_rsa RSA SHA256:...
debug1: Server accepts key: ~/.ssh/id_openshift_tst_rsa RSA SHA256:...

If you don't see these lines, it means SSH isn't using your key—go back to checking your config and agent.

4. Check Azure DevOps SSH Public Key Status

It's possible your public key was removed, expired, or replaced in Azure DevOps. Log into your Azure DevOps account, go to User Settings > SSH Public Keys, and confirm that the public key corresponding to id_openshift_tst_rsa (run cat ~/.ssh/id_openshift_tst_rsa.pub to get it) is still listed and active.

5. Double-Check Git Config (Less Likely, But Worth Confirming)

Your Git config looks standard, but just to rule out edge cases: ensure you don't have any Git-specific SSH overrides. Run this to check:

git config --list | grep ssh

If there's an entry like core.sshCommand, it might be overriding your SSH config—remove it with git config --unset core.sshCommand if needed.


内容的提问来源于stack exchange,提问作者jelmew

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:47:15