配置git,创建git本地仓库
(git的安装可以参考上一篇博文:https://blog.youkuaiyun.com/Star_woniu/article/details/129393610)
打开windows git bash, 首先创建一个新的文件夹

执行git init:

配置git用户:
git config --global user.name "name"
git config --global user.email "eamil@email.com"

创建并添加自己需要上传到远程的目录及文件:
mkdir key_helper
git add key_helper
cd key_helper/
git add mouse_recorder.ui my_recorder.py my_window.py Ui_mouse_recorder.py

Github创建远程仓库
在github创建远程仓库:

命名并提交:

创建之后就有后续步骤提示了:

一二步我们已经完成了,继续进行代码提交:
尝试提交修改
git commit -m "修改记录",提交修改:

git remote add:

git push, 发现执行失败,提示“fatal: unable to access 'https://github.com/Sampsin/learning.git/': Could not resolve host: github.com“。用过git的同学就会知道是因为没有配置ssh key

配置ssh key
使用如下命令创建:
ssh-keygen -t rsa -C "email@email.com"
ls -al ~/.ssh
cat ~/.ssh/id_rsa.pub


拷贝cat出来的内容到github,GitHub先进入setting->SSH and GPG keys



添加完毕。
执行命令检测连通性:
ssh -T git@github.com

重新提交代码
最后我们重新push代码,会弹出github的授权,选择同意:

代码push成功并查看状态:

我们可以新建一个readme并提交:

在github repo这边查看提交的代码:

Perfect!