6

I'm trying to use fabric to deploy a Django project and I get this error when I run hg pull:

[myusername.webfactional.com] run: hg pull
[myusername.webfactional.com] out: remote: Warning: Permanently added the RSA host key for IP address '207.223.240.181' to the list of known hosts.
[myusername.webfactional.com] out: remote: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
[myusername.webfactional.com] err: abort: no suitable response from remote hg!

Fatal error: run() encountered an error (return code 255) while executing 'hg pull'

I can run other mercurial commands like hg status, and hg log just fine from my fab file.

I have generated an SSH key on the server and added it to my bitbucket account. This works as I can SSH in and run hg pull and it works fine, it's only when using fabric.

This is my fabfile:

from __future__ import with_statement
from fabric.api import *

env.hosts = ['myusername.webfactional.com']
env.user = "myusername"

def development():

    # Update files
    local("hg push")
    with cd("~/webapps/mysite/mysite"):
        run("hg pull")

    # Update database
    with cd("~/webapps/mysite/mysite"):
        run("python2.6 manage.py syncdb")
        run("python2.6 manage.py migrate")

    # Reload apache
    run("~/webapps/mysite/apache2/bin/restart")

Any ideas?

EDIT:

Got this working using https

so instead of

hg pull

I'm using

hg pull https://myusername@bitbucket.org/myusername/mysite
Neil
  • 8,925
  • 10
  • 44
  • 49
  • I have the same problem here. This solves: http://lincolnloop.com/blog/2009/sep/22/easy-fabric-deployment-part-1-gitmercurial-and-ssh/ – semente Nov 24 '10 at 19:12

2 Answers2

1

Can't reproduce.

zada$ fab development
[ostars.com] Executing task 'development'
[ostars.com] run: hg pull
[ostars.com] out: pulling from ssh://hg@bitbucket.org/Zada/b
[ostars.com] out: no changes found

Done.
Disconnecting from ostars.com... done.

zada$ hg --version
Mercurial Distributed SCM (version 1.6.3)
zada$ ssh ostars.com "hg --version"
Mercurial Distributed SCM (version 1.6)
zada$ fab --version
Fabric 0.9.2

Possible reasons: versions mismatch. Or just a glitches on Butbucket :) Try run("hg pull") to be more verbose.

Zada Zorg
  • 2,778
  • 1
  • 21
  • 25
  • Thanks for your answer. I was actually having the same "Permission denied" problem when I was using git and github (one of the reasons why I switched to mercurial and bitbucket was this error). So I'll have a look into version mismatch. – Neil Sep 08 '10 at 09:42
0

To use SSH to clone or pull or push repository in BitBucket you need to follow this instruction (this document is for Mercurial on Mac OSX or Linux) :

https://confluence.atlassian.com/pages/viewpage.action?pageId=270827678

If you want to setup other ssh to to work with bitbucket, here is the full documentation :

https://confluence.atlassian.com/display/BITBUCKET/How+to+install+a+public+key+on+your+Bitbucket+account

Kannika
  • 2,538
  • 2
  • 27
  • 38