打赏

git-submodule使用

git submodule使用

(1.)常用命令

git clone <repository> --recursive  //递归的方式克隆整个项目
git submodule add <repository> <path> //添加子模块
git submodule init //初始化子模块
git submodule update //更新子模块
git submodule foreach git pull  //拉取所有子模块

(2.) 仓库文件

# .gitmodules会记录仓库路径和分支。
[submodule "test"]
	path = test
	url = http://github.com/demo/test.git

(3.)克隆带子模块的版本

方法一:
git clone project.git project2
cd project2
git submodule init
git submodule update
-----------------------------
方法二:
git clone project.git project3 --recursive

(4.)更新子模块

方法一:
cd project2
git pull
git submodule update
-------------------------------------
方法二:
cd project3/moduleA
git checkout master
cd ..
git submodule foreach git pull

expect基本用法

(1.) 安装

1.安装相应的包

    yum install -y tcl tclx tcl-devel

2.下载expect-5.43.tar.gz包(我这里用的这个包,大家也可以用别的)

 根据参数,运行./configure
 ./configure --with-tcl=/usr/lib --with-tclinclude=/usr/include/tcl-private/generic
3.make && make install  安装完毕

(2.)语法

(3.)使用示例

 #!/usr/bin/expect -f                      #声明是expect 解释器

    spawn ssh  root@192.168.19.52        #远程连接的服务器name 和 ip

    expect { 
    "yes/no" {send "yes\r";exp_continue}    #返回结果如果包含yes/no 自动填写yes
    "Password:" {send "123456\r"}           # 自动填写密码
    }
    expect "#"                  #返回任意字符
    send "sh ~/yuneecapp-ios/upload.sh\r"   #执行远程脚本
    expect "#"                #接受任意字符
    send "exit\r"           #发送退出,他自己回执行完毕后退出
    interact                  #声明为交互模式

参考链接

https://blog.csdn.net/wkyseo/article/details/81589477

https://www.cnblogs.com/jason2013/articles/4356352.html

posted @ 2022-06-10 15:51  苍山落暮  阅读(234)  评论(0编辑  收藏  举报