Skip to content

git笔记

git常用命令

拉取代码

sh
git pull --tags origin dev

初始化git仓库

sh
git init

设置用户名

sh
git config --global user.name "冰泽兰"

设置邮箱

sh
git config --global user.email "邮箱地址"

将README文件添加到暂存

sh
git add README.md

第一次提交

sh
git commit -m "first commit"

设置远程仓库地址

sh
git remote add origin https://gitee.com/xxx/test.git

推送到master仓库

sh
git push -u origin "master"

配置代理

端口为代理地址的端口

sh
git config --global http.proxy 127.0.0.1:10809
git config --global https.proxy 127.0.0.1:10809

查看代理

sh
git config --global --get http.proxy  
git config --global --get https.proxy

清空代理

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

查看Git配置

查看所有 Git 配置

sh
git config --list

查看全局配置文件

sh
cat ~/.gitconfig

查看系统配置

sh
cat /etc/gitconfig

查看所有配置及其来源

sh
git config --list --show-origin

设置 HTTP 版本为 1.1

sh
git config --global http.version HTTP/1.1

禁用 SSL 验证(出现这个报错时才需要执行:SSL certificate problem: unable to get local issuer certificate)

sh
git config --global http.sslVerify false