使用Fabric将Git拉到远程主机上

时间:2016-01-24 13:24:22

标签: git bitbucket fabric

我试图在fabfile.py中编写部署脚本。这是我的代码:

from fabric.api import *

env.user = 'user'
env.hosts = ['my_host']
env.dbname = 'foo.bar'
env.dbuser = 'pg_user'
env.dbpass = 'pg_user'
code_dir = '/cygdrive/d/folder'


def deploy():
    with cd(code_dir):
        run('git pull')
        run('pip install -r requirements.txt')
        run('manage.py migrate --all')
        run('net stop Apache2.2')
        run('net start Apache2.2')

当我尝试 fab deploy 时,我收到错误:

    [my_host] Executing task 'deploy'
    [my_host] run: git pull
    [my_host] out: Host key verification failed.
    [my_host] out:
    [my_host] out: fatal: Could not read from remote repository.
    [my_host] out:
    [my_host] out: Please make sure you have the correct access rights
    [my_host] out: and the repository exists.
    [my_host] out:
Fatal error: run() received nonzero return code 1 while executing!

git pull命令应该来自bitbucket.org repo(ssh)。它被添加到known_hosts文件中(先前克隆了repo)。两台机器都使用Windows。

从远程计算机上的命令行运行git pull工作,但它不会从Fabric部署脚本运行!

有什么想法吗?

0 个答案:

没有答案