Git-基础
2024年9月1日
Git-基础
一. 配置
利用如下代码模板生成公钥: id_rsa.pub
# 请在Git Bash中运行
git config --global user.name 'HappySimple'
git config --global user.email '1292584987@qq.com'
ssh-keygen -t rsa -C '1292584987@qq.com'登录Github,选择 "SSH and GPG keys" 选项卡,点击 "New SSH key" 添加公钥
可选配置
配置代理
# 强烈建议配置该项 (以Clash为例,它的默认端口是7890)
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy区分大小写
git config core.ignorecase false二. 使用
- 拉取代码
# 以GPT Academic项目为例
git clone https://github.com/binary-husky/gpt_academic.git- 提交代码
git init
git add .
git commit -m "备注"
git remote add origin https://github.com/HappySimple/Test.git # 仅初次提交时输入仓库地址
git push -u origin master