fabric work with git repo

#!/usr/bin/python3
# -*- coding:utf-8 -*-
# __author__ = 'liao gao xiang'

from invoke import Responder
from fabric import Connection

if __name__ == "__main__":
    # 用户名、密码、端口、连接超时时间
    # c = Connection("shiyanlou@172.168.10.3:22", connect_timeout=10)  # 简写
    c = Connection(host="172.168.10.3", user="shiyanlou", port=22, connect_timeout=10)
    skip = Responder(pattern=r'connecting|\(yes/no\)', response='yes\n')  # 如果有登录认证环境输入yes
    result = c.run("git clone https://github.com/fabric/fabric.git", pty=True, watchers=[skip])
    if result.ok:
        print("主机{}代码发布成功,操作用户用户为{}".format(result.host, result.user))
    # 初始化git仓库
    c.run("cd fabric && git init")
    # 查看文件状态
    c.run("cd fabric && git status")

转载于:https://my.oschina.net/kuakexing123/blog/3012600

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值