Git使用——与github共舞01

来源:互联网 发布:数据防泄漏国内厂家 编辑:程序博客网 时间:2024/05/20 17:38
Git基本使用
1.$mkdir Git
2.$git config --global user.name"小伙伴自己的用户名哈"
   $git config --global user.email"小伙伴自己的邮箱0.0"
3.$git init
4.$ssh-keygen -t rsa -C 小伙伴自己的@自己的.com   之后不断enter
5.$xclip -sel c ~/.ssh/id_rsa.pub   复制后添加到github
6.$新建 仓库,不要点初始化,
7.$根据提示
echo "# ×××××××" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:******/******.git
git push -u origin master
8.$
The authenticity of host 'github.com (***.***.***.***)' can't be established.RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'github.com,***.***.***.***' (RSA) to the list of known hosts.sign_and_send_pubkey: signing failed: agent refused operationPermission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.
9.接下来按照知乎大佬的方法抢救一下0.0奋斗对公钥或者秘钥进行权限降级处理:
首先,清除所有的key-pair
9.01 $ssh-add -D
9.02 $rm -r ~/.ssh
9.03 删除你在github中的public-key
重新生成ssh密钥对
9.04 $ssh-keygen -t rsa -C "xxx@xxx.com"
9.05 $chmod 0700 ~/.ssh
9.06 $chmod 0600 ~/.ssh/id_rsa*

接下来正常操作在github上添加公钥public-key:
9.07首先在你的终端运行
$xclip -sel c ~/.ssh/id_rsa.pub将公钥内容复制到剪切板
2、在github上添加公钥时,直接复制即可
3、保存
测试:在终端 ssh -T git@github.com
作者:段海宁链接:https://www.zhihu.com/question/21402411/answer/42836492来源:知乎
10.然而。。。The authenticity of host 'github.com (***.***.***.***)' can't be established.RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'github.com,***.***.***.***' (RSA) to the list of known hosts.sign_and_send_pubkey: signing failed: agent refused operationPermission denied (publickey).
11.$eval "$(ssh-agent -s)"
12.$ssh-add
13.$ssh -T git@github.com

14.重启

15.OK奋斗

   
       
原创粉丝点击