hg使用面料从bitbucket拉出来

时间:2010-09-07 20:50:35

标签: python django mercurial fabric bitbucket

我正在尝试使用fabric来部署Django项目,当我运行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'

我可以从我的fab文件中运行其他mercurial命令,例如hg statushg log

我在服务器上生成了一个SSH密钥,并将其添加到我的bitbucket帐户。这可以工作,因为我可以SSH并运行hg pull并且它工作正常,它只在使用结构时。

这是我的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")

有什么想法吗?

修改

使用https

工作

所以而不是

hg pull

我正在使用

hg pull https://myusername@bitbucket.org/myusername/mysite

2 个答案:

答案 0 :(得分:1)

无法重现。

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

可能的原因:版本不匹配。或者只是Butbucket上的故障:) 请尝试run("hg pull")更详细。

答案 1 :(得分:0)

要在BitBucket中使用SSH克隆或提取或推送存储库,您需要遵循此说明(本文档适用于Mac OSX或Linux上的Mercurial):

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

如果你想设置其他ssh来使用bitbucket,这里有完整的文档:

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