Github 问题记录
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
记录Github 常遇到的一些问题
一、git clone时报错fatal: protocol ‘https’ is not supported
原因: 使用了复制粘贴地址。不管是 shift+ins 还是 右键 paste,https 和 clone 之间的空格有隐藏的符号导致。
做法: 删除掉 clone与 https直接内容,重新键入空格。
二、git clone拉取文件不完整
1.描述
直接 git clone https… 拉取,结果有点文件夹拉取不下来,但能在GitHub页面看到却是有文件存在。
# git clone https://github.com/libopencm3/libopencm3-examples.git
Cloning into 'libopencm3-examples'...
remote: Enumerating objects: 4920, done.
remote: Counting objects: 100% (323/323), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 4920 (delta 163), reused 301 (delta 155), pack-reused 4597
Receiving objects: 100% (4920/4920), 1022.82 KiB | 2.61 MiB/s, done.
Resolving deltas: 100% (2962/2962), done.
2.原因
代码如下(示例):可以看到存在第三方的引入库 .gitmodules , libopencm3 @ 3b89fc5。
3.方法
- git submodule init && git submodule update
- git clone https://git.oschina.net/gaofeifps/body.git --recursive
# git submodule init && git submodule update
# git clone https://github.com/libopencm3/libopencm3-examples.git --recursive
Cloning into 'libopencm3-examples'...
remote: Enumerating objects: 4920, done.
remote: Counting objects: 100% (323/323), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 4920 (delta 163), reused 301 (delta 155), pack-reused 4597
Receiving objects: 100% (4920/4920), 1022.82 KiB | 2.43 MiB/s, done.
Resolving deltas: 100% (2962/2962), done.
Submodule 'libopencm3' (https://github.com/libopencm3/libopencm3.git) registered for path 'libopencm3'
Cloning into 'D:/MCU/USB_Proj/libopencm3-examples-master/libopencm3-examples/libopencm3'...
remote: Enumerating objects: 30252, done.
remote: Counting objects: 100% (595/595), done.
remote: Compressing objects: 100% (242/242), done.
remote: Total 30252 (delta 366), reused 469 (delta 349), pack-reused 29657
Receiving objects: 100% (30252/30252), 7.04 MiB | 1.99 MiB/s, done.
Resolving deltas: 100% (19652/19652), done.
Submodule path 'libopencm3': checked out '3b89fc5999874c49f6f5be65bbd5e75f7d77469c'
三、git clone 时报错
$ git clone http://192.168.0.247/chenyongen/kernel.git
Cloning into 'kernel'...
remote: Enumerating objects: 67825, done.
remote: Counting objects: 100% (2231/2231), done.
remote: Compressing objects: 100% (770/770), done.
remote: Total 67825 (delta 1583), reused 2097 (delta 1460), pack-reused 65594Receiving objects: 100% (67825/67825), 176.29 MiB | 7.24 Receiving objects: 100% (67825/67825), 178.05 MiB | 7.16 MiB/s, done.
Resolving deltas: 100% (6556/6556), done.
error: invalid path 'drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
解决
git config core.protectNTFS false
然后再重新 checkout