因为开始写代码后,偶尔会用到 github。
文章目录
最新GitHub新手使用教程(Windows Git从安装到使用)——详细图解_cdtaogang’s blog-CSDN博客_github使用教程
use token to authenticate
generate token
remote: Support for password authentication was removed on August 13, 2021-CSDN博客
解决:fatal: Authentication failed for ‘https://github.com/xxxx/git-demo.git/‘_老菜鸡w的博客-CSDN博客
创建项目的SSH Key,实现SSH免密登录
I am not sure it is ok in the new version.
git config --global user.name "yourusername"
git config --global user.email "youremail@example.com"
ssh-keygen -t rsa -C "youremail@example.com"
-t:指定密钥类型,默认是rsa,可以省略;
-C:设置注释文字,比如邮箱;
-f:指定密钥文件存储文件名。
创建成功后,在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件。
将id_rsa.pub中的内容,复制到github上的key中。
github -> 本地
git clone https://github.com/xxx/xxx.git
本地 -> github
git init # 初始化当前文件夹为版本库
# origin是远程地址的别名
git remote add origin https://github.com/xxx/xxx.git
git pull --rebase origin master
git push origin master
ssh -T git@github.com
怎样 pull requests
当需要更新对方的库时,就经常要用到 pull requests了,本来我以为会有点麻烦。但原来只需要先 fork 对方的库,然后将修改提交到自己的fork库后,再在github上点击两下就完成了,非常简单。