Github提交代码方法总结

github

1. 初始操作

echo "# supereditor" >> README.md

git init #初始化仓库

git add README.md #添加单个文件 省略后面的文件名是添加所有文件

git config --global user.name xxx #配置git

git commit -m "first commit" #将暂存区的更改提交到本地仓库,并附加提交说明

git branch -M main #将当前所在分支或指定分支强制重命名为 main

git remote add origin https://github.com/xxx/xxx.git #首次关联远程仓库

git push -u origin main #推送代码

2. 如何设置代理访问Github

全局代理设置

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

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

只对GitHub进行代理

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

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

sock5代理设置

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

git config --global https.https://github.com.proxy socks5://127.0.0.1:1086

取消代理

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

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

查看已有配置

git config --global -l
zh_CNChinese