1、在本地新建文件夹 
2、点进文件夹,右键选中“Git Bash Here”命令,进入git-shell命令窗口。 3、生成密钥(SSH key)
#可以是你登录GitHub的账户名或邮箱
ssh-keygen -t rsa -C "your_email@youremail.com"
一直回车就好,不然后面会麻烦。  4、此时 C:\Users\用户名.ssh 下会多出两个文件 id_rsa 和 id_rsa.pub,我们打开id_rsa.pub,并复制,然后打开github的设置,进行粘贴,新建密钥:    5、再回到git bash 检验是否成功 在git bash中输入:
$ ssh -T git@github.com
只要出现下面这句话,就证明成功了,可能第一次验证的时候会有四五行,只要最后出现这句话就代表成功了。可能不会成功,解决报错见下  6、输入以下命令初始化仓库:
git init
 7、开始连接远程仓库(注意避免连接空库)
#二选一
git remote add origin git@github.com:yourName/repositoryname.git
git remote add origin https://github.com/yourName/repositoryname.git
来源于此:  8、拉远程仓库
#注意是main,Github 工程默认名为了 main由于受到"Black Lives Matter"运动的影响,GitHub 从某年 10 月 1 日起,在该平台上创建的所有新的源代码仓库将默认被命名为 “main”,而不是原先的"master"。
git pull origin main
报错:
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决方法:
#编辑 ~/.ssh/config 文件,如果没有config文件的话就直接 vim ~/.ssh/config加入以下内容
Host github.com
Hostname ssh.github.com
Port 443
#作者:是苏菇凉呀
#链接:https://www.jianshu.com/p/c3aac5024877
#来源:简书
#著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
9、拉取成功,oy!  10、通过本地仓库删除,再同步到远程仓库,进而删除远程仓库的某些文件。含报错解决:
error: src refspec main does not match any
error: failed to push some refs to 'github.com:abd0412/Epidemic-tracking.git'

|