git clone 报错:Please make sure you have the correct access rights and the repository exists.

git clone git@gitlab.test.com:mypy/testproject.git


Cloning into 'testproject'...
git@gitlab.test.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

 

当确定已经在server端配置好ssh密钥,但还是无法克隆,需要分析下原因:

执行:

ssh -Tvvv git@test.com

....
debug1: Connecting to test.com[36.99.xxx.xx] port 22.
....

git clone时使用ssh协议连接服务器并且使用默认22端口,当公司使用nps或者frp等内网穿透软件映射出去的时候,内网服务器并非使用标准22端口,所以git clone时需要指定端口

git clone ssh://git@gitlab.test.com:22222/mypy/testproject.git

 

posted @ 2021-11-04 12:46  然后没有然后  阅读(198)  评论(0编辑  收藏  举报