致命:无法读取"https://github.com"的用户名:没有此类设备或地址 - rubyonrails - aws



我有一个rubyonrails网站,它的功能是,当用户用他的用户名注册时,它会在我的github帐户中用该用户名创建一个repo。它在heroku完美地工作。当我切换到亚马逊网络服务时,我最初得到的是

intializing git
sh: git: command not found
sh: line 0: cd: /home/webapp: No such file or directory

我通过在.ebextensions中添加一个类似的配置文件来克服这个错误

commands:
01_mkdir_webapp_dir:
# use the test directive to create the directory
# if the mkdir command fails the rest of this directive is ignored
test: 'mkdir /home/webapp'
command: 'ls -la /home/webapp'
02_chown_webapp_dir:
command: 'chown webapp:webapp /home/webapp'
03_chmod_webapp_dir:
command: 'chmod 700 /home/webapp'
packages:
yum:
git: []

然后我有一个新的错误日志,如

fatal: could not read Username for 'https://github.com ': No such device or address

顺便说一句,当我在本地运行这个脚本,并在localhost:3000终端注册网站时,会提示我提交github用户名和密码。这正常吗。这是导致错误fatal: could not read Username for 'https://github.com ': No such device or address的原因吗。但这段代码在heroku中运行得非常完美。

完整日志如下。https://drive.google.com/file/d/1yPYsS1ETHhrEoYFWHJxt4y52jHYRkooj/view?usp=sharing

我在aws中设置了这些环境。https://photos.app.goo.gl/GeQHXdUWUMuixTgNA

尝试直接创建git配置文件

#/home/webapp/.gitconfig
[user]
name = soumjoyel
email = soumjoyel@gmail.com

使用此脚本

files:
"/home/webapp/.gitconfig" :
mode: "000644"
owner: webapp
group: webapp
content: |
[user]
name = soumjoyel
email = soumjoyel@gmail.com

最新更新