Bash .ssh/config:第1行:错误的配置选项:\342\200\234主机
我正在尝试将代码从GitLab部署到EC2实例。然而,当我运行管道时,我得到了以下错误Bash .ssh/config:第1行:错误的配置选项:\342\200\234主机,bash,git,amazon-web-services,amazon-ec2,gitlab,Bash,Git,Amazon Web Services,Amazon Ec2,Gitlab,我正在尝试将代码从GitLab部署到EC2实例。然而,当我运行管道时,我得到了以下错误 /home/gitlab-runner/.ssh/config: line 1: Bad configuration option: \342\200\234host /home/gitlab-runner/.ssh/config: terminating, 1 bad configuration options 这是我正在使用的.gitlab ci.yml文件 stages: - QAenv
/home/gitlab-runner/.ssh/config: line 1: Bad configuration option: \342\200\234host
/home/gitlab-runner/.ssh/config: terminating, 1 bad configuration options
这是我正在使用的.gitlab ci.yml文件
stages:
- QAenv
- Prod
Deploy to Staging:
stage: QAenv
tags:
- QA
before_script:
# Generates to connect to the AWS unit the SSH key.
- mkdir -p ~/.ssh
- echo -e “$SSH_PRIVATE_KEY” > ~/.ssh/id_rsa
# Sets the permission to 600 to prevent a problem with AWS
# that it’s too unprotected.
- chmod 600 ~/.ssh/id_rsa
- 'echo -e “Host *\n\tStrictHostKeyChecking no\n\n” > ~/.ssh/config'
script:
- bash ./gitlab-deploy/.gitlab-deploy.staging.sh
environment:
name: QAenv
# Exposes a button that when clicked take you to the defined URL:
url: https://your.url.com
下面是我的.gitlab deploy.staging.sh文件,该文件是我为部署到服务器而设置的
# !/bin/bash
# Get servers list:
set — f
# Variables from GitLab server:
# Note: They can’t have spaces!!
string=$DEPLOY_SERVER
array=(${string//,/ })
for i in "${!array[@]}"; do
echo "Deploy project on server ${array[i]}"
ssh ubuntu@${array[i]} "cd /opt/bau && git pull origin master"
done
我检查了我的.ssh/config文件内容,下面是我看到的内容
ubuntu@:/home/gitlab-runner/.ssh$ cat config
“Host *ntStrictHostKeyChecking nonn”
有没有关于我做错了什么以及我应该做什么改变的想法?问题出在我身上
ubuntu@ip-172-31-42-114:/home/gitlab runner/.ssh$cat config
“主机*ntStrictHostKeyChecking非”
因为这里有一些Unicode字符,通常在我们从文档或网页复制粘贴代码时出现
在您的例子中,这个“
字符也可以在输出中看到
将其替换为“
,并检查配置中的其他配置和更新是否正常
在这个问题中有更多的细节问题在于
ubuntu@ip-172-31-42-114:/home/gitlab runner/.ssh$cat config
“主机*ntStrictHostKeyChecking非”
因为这里有一些Unicode字符,通常在我们从文档或网页复制粘贴代码时出现
在您的例子中,这个“
字符也可以在输出中看到
将其替换为“
,并检查配置中的其他配置和更新是否正常
在这个问题中有更多的细节。用
替换所有“
”
。顺便说一句:用!
替换!
。你还需要修复右引号。用“
替换所有”
。顺便说一句:用!
替换。你还需要修复右引号。