【发布时间】:2018-06-22 02:49:21
【问题描述】:
我正在尝试通过 CloudFormation 部署 Amazon EC2 实例,并且我正在尝试使用带有 cfn-init 的 bash 脚本克隆存储库。
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#! /bin/bash -xe\n",
"yum install -y aws-cfn-bootstrap\n",
"/opt/aws/bin/cfn-init -v ",
" --stack ", { "Ref" : "AWS::StackName" },
" --resource DocumentationInstance ",
" --configsets Install ",
" --region ", { "Ref" : "AWS::Region" }, "\n",
"git clone https://", { "Ref": "GitLabUsn" },"@gitlab.com/user/repository.git \n", { "Ref": "GitLabPwd" }
]]}}
}
但是,当我部署 EC2 实例时,我可以从cloud-init-output.log 看到 git clone 失败,这是错误:
fatal: could not read Password for 'https://username@gitlab.com': No such device or address
如何使用 bash 脚本正确输入密码?我试过yes 找到here
【问题讨论】:
标签: linux bash git amazon-ec2 amazon-cloudformation