Fabric git推送到错误的IP地址

时间:2017-06-14 13:21:17

标签: python git fabric

我正在使用win7并尝试使用fabric将更改推送到ubuntu 16.04 VPS。到目前为止,我有:

env.roledefs = {
    'test': ['localhost'],
    'dev': ['user@dev.example.com'],
    'production': ['deploy@xxx.xx.xx.xx']
}

@roles('production')
    def dir():
        env.key_filename = '~/.ssh/id_rsa'
        local("pip freeze > requirements.txt")
        local("git add . --all && git commit -m 'fab'")
        local("git push myproject master")
        run('pwd')
        ...

当我运行它时,输出是:

$ fab dir
[deploy@xx.xx.xx.xx] Executing task 'dir'
[localhost] local: pip freeze > requirements.txt
[localhost] local: git add . --all && git commit -m 'fab'
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
[master warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
256de92] 'fab'
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
 3 files changed, 10 insertions(+), 9 deletions(-)
[localhost] local: git push example master
debug1: Connecting to 198.91.88.101 [198.91.88.101] port 22.
debug1: connect to address 198.91.88.101 port 22: Connection refused
ssh: connect to host 198.91.88.101 port 22: Bad file number
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Fatal error: local() encountered an error (return code 128) while executing 'git push example master'

所以面料试图推送到错误的目标IP地址(这是一个旧的vps地址。我不再拥有它。)我摆脱了VPS但保存了公钥和私钥并将pub键上传到了我的新IP地址的新vps

问题是我不确定旧目标地址的设置位置。这是一个git问题。如何重定向结构以推送到@roles(' production')

当我查看我的.ssh / known_hosts时,我看到198.91.88.101。所以我想知道这是否涉及某种方式。

1 个答案:

答案 0 :(得分:2)

它是在git远程配置中。与git remote --verbose验证。