2017-02-09 7 views
0

私はfabric3(https://pypi.python.org/pypi/Fabric3)、つまりPython 3ポートのファブリックを扱っています。Fabricコマンドが特定のsshキーで動作しない

私はのgit - bashのを使用してwin7の中でローカルに実行しているwchich以下の機能を持っている:

@roles('production') 
def dir(): 
    env.key_filename = '~/.ssh/deploy' 
    local("git push mysite master") 
    run('pwd') 
    run('ls') 
    code_dir = '/home/deploy/mysite' 
    with cd(code_dir): 
     run('pwd') 
     run('git reset --hard master') 
     run('ls -la') 

出力:私は機能を実行すると

$ fab dir 
[[email protected]] Executing task 'dir' 
[localhost] local: git push mysite master 
[email protected]'s password: 

、私はパスワードの入力を求められます。キーを無視しているようです。所定のキーを使用するにはどうすればよいですか?

+0

パスワードは 'git push'で尋ねられますか? – Leon

+0

はいそうです。 – user61629

+0

'git push'は' fabric'の下で実行され、 'fabric'で管理されていない別の接続を使ってリモートホストに接続します。 – Leon

答えて

0

ユーザーとしてgitを.ssh/configファイルに追加したところ、動作するように見えました。

Host deploy 
HostName 198.x.x.x 
User deploy 
PreferredAuthentications publickey 
IdentityFile ~/.ssh/deploy 
IdentitiesOnly yes 

Host 198.x.x.x 
HostName 198.x.x.x 
User git 
IdentityFile ~/.ssh/deploy 
関連する問題