当我用git pull拉动时,我如何看到我正在使用哪个ssh键?(How do i see which ssh key i’m using when pulling with git pull?)

当我用git pull拉动时,如何查看我正在使用哪个ssh键?

我可以看到如何用~/.ssh/config ( https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use )指定一个键,但它会是很高兴得到一些输出,说明我正在使用哪个键。

How do I see which ssh key i’m using when pulling with git pull?

I can see how to specify a key with ~/.ssh/config (https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use ) but it would be great to get some output that says exactly which key I'm using.

最满意答案

您可以通过将其传递给GIT_SSH_COMMAND环境变量来为ssh指定详细级别:

GIT_SSH_COMMAND="ssh -vvv" git pull

那可能会给你更多你想要的信息。

过滤味道:

GIT_SSH_COMMAND="ssh -v" git pull 2>&1 | awk -F\: '/Offering.*key/ { print $3 }'

You can specify verbosity level to ssh by passing it in the GIT_SSH_COMMAND environment variable:

GIT_SSH_COMMAND="ssh -vvv" git pull

That will probably give you more info that you want.

Filter to taste:

GIT_SSH_COMMAND="ssh -v" git pull 2>&1 | awk -F\: '/Offering.*key/ { print $3 }'

更多推荐