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

Bitbucket Pipeline部署遇SSH密钥Unicode解码错误求助

Bitbucket Pipeline SSH密钥配置报错问题

运行Bitbucket Pipeline CI/CD时,用于服务器访问的SSH密钥(.key证书)配置出错,错误输出如下:

Digest: sha256:b9111f61b5824ca7ed1cb63689a6da55ca6d6e8985eb778c36a5dfc2ffe776a8
Status: Downloaded newer image for bitbucketpipelines/scp-deploy:1.2.1
INFO: Using passed SSH_KEY...
Traceback (most recent call last):
  File "/pipe.py", line 108, in <module>
    pipe.run()
  File "/pipe.py", line 76, in run
    self.setup_ssh_config()
  File "/pipe.py", line 44, in setup_ssh_config
    f.write(base64.b64decode(ssh_key).decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 42: invalid start byte

我将.key证书存入Pipeline设置的变量$DO_KEY_QA中,相关配置如下:

--env=DOCKER_HOST="tcp://host.docker.internal:2375" \
   --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
   --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/scp-deploy" \
   --env=LOCAL_PATH="output-$BITBUCKET_BUILD_NUMBER.tar.gz" \
   --env=REMOTE_PATH="/opt/tmp/" \
   --env=SERVER="144.22.196.99" \
   --env=SSH_KEY="$DO_KEY_QA" \
   --env=USER="deploy" \

已尝试将证书转成base64格式但仍报错,疑惑为何不能直接将证书作为字符串读取?


内容的提问来源于stack exchange,提问作者Christian Guimarães

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 07:53:26