Git
修改时间:2025年06月23日
预计阅读:1 分钟
文章字数:342
安装
Linux安装Git
1 2
| sudo yum install git git --version
|
配置
长期保存登录凭证
1
| git config --global credential.helper store
|
暂时缓存登录凭证
1 2 3 4
| git config --global credential.helper cache git config --global credential.helper 'cache --timeout=3600'
默认储存15分钟,可以自定义设置保存时间
|
命令
克隆
1 2 3 4 5
| git clone <repository-url> git clone <repository-url> <directory-name>
<repository-url> 是Git仓库的URL <directory-name> 是本地创建并存放克隆代码的文件夹名称
|
拉取
暂存
提交
1 2 3 4 5 6
| 提交已经 add 过的文件 git commit -m "the commit message"
会把所有跟踪且修改的文件 add 进来,然后提交,但不会add新建的文件 对于新建的文件,还是需要先执行 add 命令后在提交 git commit -a "the commit message"
|
推送
错误处理
💗💗 git 报错信息:SSL certificate problem: certificate has expired 解决方案
1 2 3 4 5
| 使用git时报错,错误信息如下: unable to access 'https:/xxxxxxx.git/': SSL certificate problem: certificate has expired
修改配置:忽略SSL证书验证 git config --global http.sslVerify false
|
学习资源
- 视频
- 【尚硅谷】5h打通Git全套教程丨2021最新IDEA版
https://www.bilibili.com/video/BV1vy4y1s7k6
- 书籍
- 猴子都能懂的 Git 入门
https://backlog.com/git-tutorial/cn/
- GitHub 漫游指南
https://github.phodal.com/
- 文档
- GitHub 官方文档:
https://docs.github.com/cn
- 游戏
- Learning Git Branching:
https://learngitbranching.js.org/?locale=zh_CN