当前位置:   article > 正文

git (二) 拉库_拉库地址哪里找的

拉库地址哪里找的
git clone + 协议 + 地址

github 已经不能使用 http 协议 推库,但是可以用http协议拉库

  • 1
  • 2
  • 3
  • 4
拉完整库
git clone  url
  • 1
拉库的一部分
  • 文件夹
git的实现:基于sparse clone变通方法

[root@vm_test backup]# mkdir devops
[root@vm_test backup]# cd devops/
[root@vm_test devops]# git init    #初始化空库
Initialized empty Git repository in /backup/devops/.git/
[root@vm_test devops]# git remote add -f origin http://laijingli@192.168.1.1:90/scm/beeper/yunxxx_ops.git   #拉取remote的all objects信息
Updating origin
remote: Counting objects: 70, done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 70 (delta 15), reused 0 (delta 0)
Unpacking objects: 100% (70/70), done.
From http://192.168.1.1:90/scm/beeper/yunxxx_ops
 * [new branch]      master     -> origin/master
[root@vm_test devops]# git config core.sparsecheckout true   #开启sparse clone
[root@vm_test devops]# echo "devops" >> .git/info/sparse-checkout   #设置需要pull的目录,*表示所有,!表示匹配相反的
[root@vm_test devops]# more .git/info/sparse-checkout
devops
[root@vm_test devops]# git pull origin master  #更新
From http://192.168.1.1:90/scm/beeper/yunxxx_ops
 * branch            master     -> FETCH_HEAD
[root@vm_test devops]# ls
devops
[root@vm_test devops]# cd devops/
[root@vm_test devops]# ls
monitor_in_web  test.1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 文件
// 拉单个文件

// 不拉文件,而是打印文件

  • 1
  • 2
  • 3
  • 4
拉库,切换分支
git clone file:///home/SWS/test/remote-repo/repo1  -b dev
  • 1
拉库,并重命名本地仓库
git clone  url new_name
  • 1
拉库,指定分支
git clone -b 分支名 仓库url
  • 1
拉库,指定版本
拉库,只要一个提交
git clone --depth=1 --branch=master url
  • 1
拉库,不要.git
git clone --depth=1 --branch=master url
rm -rf ./repo/.git
  • 1
  • 2
先拉库,在拉提交
原因 : fatal: fetch-pack: invalid index-pack
git clone --depth 1  git@github.com:lisider/linux.git
cd linux
git pull --unshallow



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/539197
推荐阅读
相关标签
  

闽ICP备14008679号