使用git远程链接GitHub仓库

SSH 公钥

git bash运行ssh-keygen -t rsa,SSH会存储在如下名为id_rsa的pub文件中。html

添加SSH

GitHub点击设置,找到SSH and GPG keys,将上述SSH公钥copy上去。git

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-accountgithub

建立新仓库

  1. 先在GitHub页面Create a new repository,再在git bash执行git clone https://github.com/ikventure/cs61a-sp21将远程仓库克隆到本地。bash

  2. 或者直接在本地建立新文件夹,打开,而后执行git initssh

暂存 add

在项目文件夹中对文件进行增删改以后,运行git add.将全部改动暂存.net

提交 commit

git commit -m "commit information"将暂存的更改提交到本地仓库,并添加更改信息。code

推送 push

git push origin main将更改推送到远程仓库。orm

出现errno 10054可尝试git push -u origin main进行验证,也能够尝试修改hosts。htm

提升git速度

https://www.ipaddress.com/ 查询github.com或github.global.ssl.fastly.net的IP添加到hosts文件中。blog

备注

码云操做同GitHub,能够考虑。

git部分配置可参考
http://www.javashuo.com/article/p-ojxxjfeg-wu.html