`ssh -T` to VSTS(Azure Devops) authenticates successfully, but `git clone` fails

前端 未结 3 1577
南笙
南笙 2021-01-05 06:39

I recently created a second key to access Visual Studio Team Services,

ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"

so I now ha

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 07:22

    You need to force the client to use specific private key, otherwise it uses the default one.

    To check which private key file used for a host, you can run

    ssh -v [host(e.g. test@test.visualstudio.com)]
    

    One way is that you can configure it in the config file. (My steps for windows)

    1. Run touch .ssh/config if there isn’t config file in .ssh folder
    2. Open config file

    code:

    Host xx.visualstudio.com
      IdentityFile /c/Users/xx/.ssh/id_vsts
    
    1. Open new command line and run Git clone command

    Another way is that, you can run ssh -i /path/to/id_rsa user@server.nixcraft.com command.

    More information, you can refer to this article: Force SSH Client To Use Given Private Key (identity file)

提交回复
热议问题