esc阿里云免密登录挖坑-vscode deploy插件

阿里云免密登录实操

# 生成公钥

# 改成加一个 pem参数
ssh-keygen -t rsa -m PEM -P ''  

xubin@xubindeMBP:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xubin/.ssh/id_rsa):
/Users/xubin/.ssh/id_rsa already exists.
Overwrite (y/n)? yes
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/xubin/.ssh/id_rsa.
Your public key has been saved in /Users/xubin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:IeFPfrcQ3hhP64SRTAFzGIHl2ROcopl5HotRi2XNOGk xubin@xubindeMBP
The key's randomart image is:
+---[RSA 2048]----+
|      .o*@=o     |
|     ..oEB=o     |
|      o@=+O .    |
|      B=+o @ .   |
|       =So* *    |
|      . o. = .   |
|            o    |
|                 |
|                 |
+----[SHA256]-----+

# 查看公钥
cat .ssh/id_rsa.pub 

# 将公钥拷贝到服务器
scp ~/.ssh/id_rsa.pub root@47.98.252.XXX:/root

# 将公钥加入信任列表(服务器操作)
cat id_dsa.pub >> ~/.ssh/authorized_keys

deploy插件坑

1. 报错提示如下:解释私钥不能parse。

Copy Files Over SSH: Cannot parse privateKey: Unsupported key format

解决方案: 上面生产密钥对的过程,要加参数 --pem生成的密钥对就可以了。
参考链接:https://github.com/microsoft/azure-pipelines-tasks/issues/8818

image.png

2. 当右键deploy上传的时候报如下错误

[Error] Could not deploy file '<file>': Error: Could not get relative path for <file>

解决方案:https://github.com/mkloubert/vs-deploy/issues/135
把项目单独的作为vscode的单项目就可以了。否则会报这个错误。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。