2016-04-06 41 views
-2

我們目前的工作流程設置如下: 開發服務器 - >回購/ CI服務器(在這種情況下Gitlab/Gitlab-CI) - >生產服務器部署回購開發。

我想我目前的項目部署到生產服務器。現在我有一個非常簡單的ci文件。

我的問題是以下。每當賽跑運動員。我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 [email protected] 
 
cd /var/www 
 
sudo git init 
 
sudo git clone http://gitlab.panoramalife.com/cpadilla/PruebaDeploy.git

,我這給我這個錯誤

你們可以幫我找出這個嗎?提前致謝。

+0

你應該給一個解釋,而不是很多代碼 –

回答

1

有幾件事情需要修復才能使其運行。

須藤:無法解析主機無業遊民

這可能意味着你改變了機器的主機名,但未能編輯/etc/hosts和/或/etc/hostname。你的新主機名需要在/etc/hostname/etc/hosts你需要有一條線127.0.0.1 <hostname>。現在重新啓動機器。

須藤:不存在TTY並沒有askpass程序指定

這是因爲須藤會提示您輸入密碼,但不能因爲沒有終端存在。你需要編輯sudoers文件與文件sudo visudo,需要添加以下行:

desarrollo ALL = NOPASSWD: /bin/git 

這告訴sudo的,這個用戶沒有使用Git的命令需要密碼。