user61629 user61629 -3 years ago 78
Git Question

Fabric git pushing to wrong ip address

I'm working on win7 and trying to use fabric to push changes to an ubuntu 16.04 VPS. So far I have:

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')
...


When I run this the output is:

$ 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'


So fabric is trying to push to the wrong target ip address (this was an old vps address . I no longer have it.) I got rid of the VPS but saved the public and private key and uploaded the pub key to my new vps at a new ip address

The problem is I'm not sure where the old target address is being set. Is this a git issue. How do I redirect fabric to push to @roles('production')

When I look in my .ssh/known_hosts I see 198.91.88.101. So I'm wondering if that is involved in some way.

Answer Source

It is in the git remote configuration. Verify with git remote --verbose.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download