git 仓库配置
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
1. 常用 Git 仓库
腾讯工蜂 https://git.code.tencent.com gitcode.com
2. git
3. 安装 git
蝈蝈强烈要求读者,先读下文,然后再碰安装包。
3.1. 中国用户问题
中国地区的 Window 宝宝请访问中国下载地址,最新日期的第一个链接即可

3.2. path 环境变量问题
安装的时候,为了方便以后操作,下面的修改环境变量操作选第二个,其它操作建议选择默认。

4. shell 操作
- 点击
Windows + R
打开在运行界面 - 输入powershell 后,打开powershell

在弹出的软件中输入git version
,回车查看 git
版本,确认安装成功

确认成功安装后,依次输入以下命令回车执行,使用前面记录的信息替换相关内容,全程一律回车,直到执行完毕。
5. 设置 git
1 | # 查看 git 版本 |
6. 创建本地仓库
1 | git init # 初始化仓库 |
7. 配置远程仓库
git remote add origin git@。。。。。。。。。。。。。。。 git push -u origin --all
8. 配置 SSH-Key
8.1. 生成密钥对
1 | # 格式 |
8.2. 配置 ssh config 文件
模板
1 | # 仓库名 |
config
1 | # github |
1 | ssh -T git@github.com |
9. git 撤销已经push的提交
- git branch 查看分支
- git log 查看提交日志
- git reset 重置当前HEAD到指定的状态
- git push
git log
git reset --soft
git push origin master --force
git clone --depth 1
10. 模块
1 | # 添加默认分支 |
1 | README.md |
11. github 访问慢
mirrors - GitCode https://gitcode.com/org/mirrors
使用 gitcode 替代 github 访问源 使用 kkgithub 替换 github 在线访问下载