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

测试GitHub SSH连接成功后执行git pull仍需输入账号密码的解决方法

解决GitHub SSH验证成功但Git操作仍需输入密码的问题

Hey Parsa237, I’ve run into this exact issue before—let’s break down what’s happening and fix it:

First, that SSH test output (Hi Parsa237! You've successfully authenticated, but GitHub does not provide shell access.) only confirms that your local SSH key is correctly paired with your GitHub account. The problem here is almost certainly that your repository is using an HTTPS remote URL instead of SSH, so Git isn’t even trying to use your SSH key for operations like git pull.

Here’s how to fix this step by step:

1. Check your current remote repository URL

Run this command in your local repo directory to see what remote URL Git is using:

git remote -v

You’ll see output like this if it’s using HTTPS:

origin  https://github.com/Parsa237/your-repo.git (fetch)
origin  https://github.com/Parsa237/your-repo.git (push)

If you see https:// instead of git@github.com:, that’s the root cause.

2. Switch the remote URL to SSH

Run this command to replace the HTTPS URL with the SSH version (make sure to replace Parsa237/your-repo.git with your actual GitHub username and repo name):

git remote set-url origin git@github.com:Parsa237/your-repo.git

3. Verify the change

Run git remote -v again—you should now see the SSH URL instead of HTTPS:

origin  git@github.com:Parsa237/your-repo.git (fetch)
origin  git@github.com:Parsa237/your-repo.git (push)

4. Test a Git operation

Try running git pull now—you shouldn’t need to enter a username/password anymore, and your SSH key will finally be used for authentication.

A quick side note: If you have multiple SSH keys set up (for different GitHub accounts or services), you might need to add a config file in ~/.ssh/config to tell Git which key to use for GitHub. But since you mentioned your key was never used, the remote URL switch is almost certainly the fix you need.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 21:32:39