Skip to content

Commit 3044c68

Browse files
authored
Merge pull request #3 from lec-org/sy_new
修改了push大文件,增加了clone等操作网速过慢的解决办法
2 parents 9f5c941 + e36188d commit 3044c68

File tree

4 files changed

+56
-1
lines changed

4 files changed

+56
-1
lines changed

Git.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,13 @@ https://www.cnblogs.com/FraserYu/p/11192840.html
784784

785785
[[Git如何push大文件]]
786786

787+
---
788+
## Windows中使用Git速度过慢
789+
790+
在确保像本文档开头“配置”一栏那样设置过可靠的代理后,请继续阅读:
791+
[[git clone或push速度过慢]]
787792

793+
---
788794

789795

790796
## 轶事

杂类知识/Git如何push大文件.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# push大文件
12

23
[glf](https://git-lfs.com/)
34

@@ -28,4 +29,22 @@ git add .gitattributes
2829
git add .
2930
```
3031

31-
之后不需要任何特殊操作,正常commit和push即可
32+
之后不需要任何特殊操作,正常commit和push即可
33+
34+
> note:glfs能免费管理的文件大小有限,只有1GB,多了要收费
35+
36+
![[Pasted image 20240902214746.png]]
37+
38+
# clone包含大文件的项目
39+
40+
如果使用glfs管理项目,那么当你直接用github主页的下载zip来下载仓库,你会发现所有的文件都是坏的。
41+
42+
其实不是坏的,只不过默认下载的是*大文件的指针*,你需要手动把大文件本体拉下来
43+
44+
```bash
45+
# 进入仓库目录后操作
46+
git lfs pull
47+
```
48+
49+
50+
速度很快(*在解决了速度慢的问题后*)
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
**Windows系统**中,你会发现使用命令行clone和push等命令的网速要明显低于Linux,设置代理也无济于事,在经过了查找之后,发现了一种可能的解决方案
3+
4+
请打开`powershell`或者`cmd`,输入这两行命令
5+
```bash
6+
netsh interface tcp set global autotuninglevel=normal
7+
netsh interface tcp set heuristics disabled
8+
```
9+
10+
他们的作用是:
11+
12+
`netsh interface tcp set global autotuninglevel=normal`
13+
- **自适应调优(Auto-Tuning)**:这是一个 Windows 网络堆栈中的功能,用于动态调整 TCP 接收窗口大小,以最大限度地提高网络吞吐量。在默认情况下,Windows 会自动调整这个窗口的大小,以适应网络状况。
14+
- **命令含义**:将 `autotuninglevel` 设置为 `normal`,表示启用标准的接收窗口自动调优。这个设置有助于在不同的网络条件下,动态优化数据传输速度。
15+
16+
`netsh interface tcp set heuristics disabled`
17+
- **TCP 启发式调优(TCP Heuristics)**:这是 Windows 中的一项功能,用于根据网络连接的历史行为来调整网络设置,如自适应调优等。它有时会限制自适应调优功能,以减少数据传输的波动。
18+
- **命令含义**:将 `heuristics` 设置为 `disabled`,表示禁用这种启发式调整。这可以确保自适应调优功能完全发挥作用,不受历史连接行为的影响,从而提高传输效率。
19+
20+
> 这两行命令的组合可以帮助优化 Windows 系统下的 TCP 网络性能,特别是在处理大文件或高带宽应用时可能会显著改善数据传输速度。
21+
22+
*若是想调回默认设置,请设置:*
23+
```bash
24+
netsh interface tcp set global autotuninglevel=disabled # 这个默认好像就是normal
25+
netsh interface tcp set heuristics enabled
26+
```
27+
28+
参考:
29+
https://superuser.com/questions/1508188/extremely-slow-git-clone-on-windows
30+
https://stackoverflow.com/questions/45768893/git-clone-in-windows-much-slower-than-in-linux

0 commit comments

Comments
 (0)