scp拷贝

作者: 狼性代码人 | 来源:发表于2021-09-01 11:32 被阅读0次

    1、使用环境
    2、操作
    3、原理

    一、使用环境

      无法通过 Git/Repo 从远程服务端拉取源码,但局域网其他电脑存有备份;

    二、操作

    以存有备份的电脑作为 ssh 服务端
    • 安装 ssh 服务:
      sudo apt-get install ssh-server
      apt-cache search ssh
      apt-cache search ssh-server
      sudo apt-get install openssh-server
    客户端电脑:
    • 同步repo信息:scp -r <server-username>@<server-ip>:<repo-path> <copy-path>(可能需要 服务端 密码)
      server-username => 服务端用户名;
      server-ip => 服务端ip地址
      repo-path => 服务端.repo地址
      copy-path => 客户端拷贝地址
      例如:$ scp -r zhys@000.000.111.11:/home/zhys/mooc/.repo ./
    • 同步repo:repo sync -l
    • 初始化仓库:repo init -u ssh://username@000.00.11.11:8080/all/manifests -b master_1b
    • 同步代码:repo sync -c --no-tags

    三、原理

    • scp -r ....操作: 把ssh服务端的.repo拷贝过来,并同步下来(即:拷贝.repo目录,然后执行了repo sync的操作)
    • repo init ....操作: 相当于用客户端的用户信息覆盖服务端的用户信息
    • repo sync ....操作: 同步下信息

    相关文章

      网友评论

          本文标题:scp拷贝

          本文链接:https://www.haomeiwen.com/subject/mrsxwltx.html