惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
小众软件
小众软件
The Cloudflare Blog
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
博客园 - 叶小钗
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
Y
Y Combinator Blog
D
Docker
Microsoft Azure Blog
Microsoft Azure Blog

lvbibir's Blog

shell | 磁盘空间分析脚本 Linux cat 和 tee 命令写入文件 python | 使用 uv 管理你的 python 环境 Claude Code 完整配置指南 windows | mihomo 内核独立部署指南 linux | 磁盘扩容 wsl | 释放长久运行占用的磁盘空间 mysql | 线程上限问题处理 麒麟 7.6 安装谷歌 OTP 认证模块 suse 12sp5 升级 openssh 及 openssl suse 12sp5 部署 mysql 5.7 《谁的青春不迷茫》 docker | centos7 部署 docker vim | 基础配置和使用 windows | rime 输入法 & 雾凇方案 shell | sshpass 批量传输文件及执行命令 wsl | 原生 linux 方式安装 docker nodejs | fnm + pnpm 开发环境配置 wsl | 安装配置 miniconda 虚拟环境 wsl | 自动更新系统代理 wsl | bashrc 环境变量不正确加载的处理方法 wsl | win10 安装 wsl2 troubleshooting | ssh 成功但是 scp 失败 linux | 常用命令总结 docker 部署 piclist shell | 检测网站存活并自动钉钉告警 Zabbix | 监控端口连通性并自动追踪 TCP 路由 windows | 自定义开机快速启动项 windows | miniconda 配置 python 虚拟环境 Zabbix | 监控主机到指定 ip 的流量大小
git
lvbibir · 2022-06-01 · via lvbibir's Blog
文章目录
  • 1 git
    • 1.1 submodule
    • 1.2 branch 管理
  • 2 git 配置
    • 2.1 设置代理
    • 2.2 CRLF 和 LF
  • 3 常见问题
    • 3.1 git clone 报错

1.1 submodule

当 clone 一个含有子模块的 git 仓库时可以使用如下命令安装所有子模块

git submodule init
git submodule update

1.2 branch 管理

查看分支

创建分支

# 以当前分支为模板创建并切换分支
git checkout -b dev
# 以 master 为模板创建并切换分支, master 可以是哈希值或者 origin/master 这种远程地址
git checkout -b dev master

# 推送分支, 如远端不存在则自动创建
git checkout dev
git push origin dev

删除分支

# 本地删除
git checkout master
git branch -d dev
# 如果分支包含未合并的更改,使用 `-D` 强制删除
git branch -D dev

# 远端删除
git push origin --delete dev
# 或
git push origin :dev

2 git 配置

查看 git 设置

# 当前仓库
git config --list
# 全局配置
git config --global --list

2.1 设置代理

设置全局代理,使用 http 代理

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

取消 github.com 代理

git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy

设置全局代理,使用 socks5 代理

git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

取消全局代理

git config --global --unset http.proxy
git config --global --unset https.proxy

只对 github.com 使用代理

git config --global http.https://github.com.proxy http://127.0.0.1:7890
git config --global https.https://github.com.proxy http://127.0.0.1:7890

2.2 CRLF 和 LF

# 提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true   
# 提交时转换为LF,检出时不转换
git config --global core.autocrlf input   
# 提交检出均不转换
git config --global core.autocrlf false

# 拒绝提交包含混合换行符的文件
git config --global core.safecrlf true   
# 允许提交包含混合换行符的文件
git config --global core.safecrlf false   
# 提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

3 常见问题

3.1 git clone 报错

fatal: early EOF

fatal: fetch-pack: invalid index-pack output

解决

git config --global http.sslVerify "false"

git config --global core.compression -1

以上

wechat_pay

微信

alipay

支付宝