GitHub创建仓库及配置

一、新建仓库

Your Repositories→New


image.png
二、配置用户

用bash.exe执行以下命令
git config --global user.name "github用户名"
git config --global user.email "github邮箱"


image.png
三、获取SSH密钥

1.获取密钥
ssh-keygen -t rsa -C "github邮箱"

image.png

2.找到公钥文件并复制内容
image.png

3.设置github密钥
右上角Settings→SSH and GPG keys→New SSH key
image.png

4.绑定SSH连接
$ ssh -T git@github.com
image.png

四、项目上传到仓库

1.获取仓库https链接

image.png

2.仓库初始化
在项目文件路径中执行初始化
git init
image.png

3.添加到本地
git add .
image.png

4.提交到本地仓库
git commit -m "提交备注"
image.png

5.添加远程仓库地址
git remote add origin https://github.com/1760Summer/Games.git
image.png

6.申请提交token
右上角Settings→Developer settings→Personal access tokens→Tokens(classis)→Generate new token(classis)
image.png

得到提交token
image.png

7.提交到远程仓库
git push origin master
username:邮箱地址
password:提交token
image.png

8.防止每次提交都要输入token
git config --global credential.helper manager-core
image.png

输入后再次提交会出现Authorize Git Credential Manager验证,点击验证后,以后提交不再需要token

配置中可能遇到的问题

1.默认的22端口无法访问


image.png

解决方法:
将22端口改为443端口
新建config文件


image.png

内容为
Host github.com

Hostname ssh.github.com
Port 443

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容