设置代理
参考Git设置代理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
git config --global https.proxy http:
git config --global https.proxy https:
git config --global http.proxy socks5: git config --global https.proxy socks5:
git config --global http.https: git config --global https.https:
git config --global --unset http.https: git config --global --unset https.https:
git config --global --unset http.proxy git config --global --unset https.proxy
|
Github上传项目
首先New repository
填写项目信息创建仓库
上传项目的命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| #第一次上传 echo "# test" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin git@github.com:h0pe-ay//*****..git git push -u origin main
#后面几次上传 git remote add origin git@github.com:h0pe-ay/*****.git #git branch -M main git branch -f main HEAD git push -u origin main
|
更新项目
1 2 3 4 5
| git add * git commit -m "" git branch -f main HEAD git push -u origin main git push origin master -f
|
生成ssh key
1 2
| #生成ssh key ssh-keygen -t rsa -C "youremail@example.com
|
在C盘->用户名->.ssh
文件夹下有个id_rsa.pub
文件复制到github
设置中SSH and GPG keys
->New SSH key
中
push超时
参考文章git报错ssh: connect to host github.com port 22: Connection timed out
- C盘->用户名->
.ssh
文件夹下创建config
文件添加如下信息
1 2 3 4 5 6
| Host github.com User YourEmail Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa Port 443
|