【问题标题】:Deploying repo to development将 repo 部署到开发中
【发布时间】:2016-04-06 17:34:38
【问题描述】:

我们当前的工作流程设置如下: 开发服务器 --> Repo/CI 服务器(在本例中为 Gitlab/Gitlab-CI)--> 生产服务器

我想将我当前的项目部署到生产服务器。现在我有一个非常简单的 ci 文件。

我的问题如下。每当跑步者运行 .my gitlab-ci.yml 文件时,我都会遇到权限问题(我想)

sudo: unable to resolve host vagrant
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified
clonando
sudo: unable to resolve host vagrant

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified

我的 .gitlab-ci.yml 文件如下:

image: php56
before_script:
- bash server.sh 
job1:
    script:
        - php -v

这是我的 bash 文件:

echo -e "Logging to server \n"
sshpass -p Password ssh -T desarrollo@192.168.105.24
cd /var/www 
sudo git init
sudo git clone http://gitlab.panoramalife.com/cpadilla/PruebaDeploy.git

它给了我这个错误。

我该如何解决这个问题?

【问题讨论】:

  • 你应该给出解释,而不是很多代码

标签: deployment gitlab gitlab-ci


【解决方案1】:

为了让它运行,有几件事需要修复。

sudo: 无法解析主机 vagrant

这可能意味着您更改了机器的主机名,但未能编辑 /etc/hosts 和/或 /etc/hostname。您的新主机名需要在/etc/hostname/etc/hosts 中,您需要有一行127.0.0.1 <hostname>。现在重启机器。

sudo:不存在 tty,也没有指定 askpass 程序

发生这种情况是因为 sudo 会提示您输入密码,但因为没有终端而不能。您需要使用sudo visudo 编辑sudoers 文件并需要添加以下行:

desarrollo ALL = NOPASSWD: /bin/git

这告诉 sudo 这个用户不需要密码来使用 git 命令。

【讨论】:

    猜你喜欢
    • 2015-09-04
    • 2012-12-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-18
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    相关资源
    最近更新 更多