【问题标题】:Fabric git pushing to wrong ip addressFabric git推送到错误的IP地址
【发布时间】:2017-06-14 13:21:16
【问题描述】:

我正在开发 win7 并尝试使用结构将更改推送到 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'

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

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

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

【问题讨论】:

    标签: python git fabric


    【解决方案1】:

    它在 git 远程配置中。使用git remote --verbose 进行验证。

    【讨论】:

    • $ git remote --verbose example ssh://deploy@198.91.88.101/~/example (fetch) example ssh://deploy@198.91.88.101/~/example (push)跨度>
    猜你喜欢
    • 2014-06-01
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2018-01-28
    • 2021-07-07
    • 2019-11-02
    相关资源
    最近更新 更多