win7下使用git bash 访问github(总是报permissions 0644 too open)

配置过程请参加博客

http://www.xbc.me/install-git-on-windows/

和github help https://help.github.com/articles/set-up-git

最后一步提交代码到github仓库:

git push origin master

问题来了:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @    WARNING: UNPROTECTED PRIVATE KEY FILE!          @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> Permissions 0644 for
> '/h/Users/Tim/.ssh/id_rsa' are too
> open. It is recommended that your
> private key files are NOT accessible
> by others. This private key will be
> ignored. bad permissions: ignore key:
> /h/Users/Tim/.ssh/id_rsa Permission
> denied (publickey).

查看文件权限:

Tim@HZ ~
$ ls -al /h/Users/Tim/.ssh/
total 16
drwxr-xr-x 7 Tim Administ 4096 Oct 28 16:11 .
drwxr-xr-x 1 Tim Administ 20480 Oct 28 16:39 ..
-rw-r--r-- 1 Tim Administ 1675 Dec 28 2012 github_rsa
-rw-r--r-- 1 Tim Administ 394 Dec 28 2012 github_rsa.pub
-rw-r--r-- 1 Tim Administ 1671 Oct 28 18:59 id_rsa
-rw-r--r-- 1 Tim Administ 403 Oct 28 18:59 id_rsa.pub
-rw-r--r-- 1 Tim Administ 1199 Oct 28 16:36 known_hosts

尝试着用chmod命令修改id_rsa的权限为0600,发现死活没法修改,在网上搜了半天,发现很多人也遇到了这种问题,但是都没有解决。

在绝望之际,搜到了博客

http://blog.csdn.net/johnnywww/article/details/8667168

试着按照里面的方法配置ssh-key生成了git.key和git.key.pub,终于成功了!!!!

  1. ssh-keygen -t rsa -C "xxx@163.com" -f git.key  
将生成的key git.key  git.key.pub 拷贝到~/.ssh中去。
将git.key.pub拷贝到github上去
编辑~/.ssh中的config文件(没有的话,新建一个),输入如下内容(git.key是私有的key文件)
  1. Host github.com  
  2. User xxx  
  3. Hostname github.com  
  4. PreferredAuthentications publickey  
  5. IdentityFile ~/.ssh/git.key
ssh -Tv git@github.com
 
感谢http://blog.csdn.net/johnnywww/article/details/8667168的博主,让我5个小时的努力没有白费啊!!

 

 

posted on   kobe_tim  阅读(671)  评论(0)    收藏  举报

编辑推荐:
· 微服务架构学习与思考:微服务拆分的原则
· 记一次 .NET某云HIS系统 CPU爆高分析
· 如果单表数据量大,只能考虑分库分表吗?
· 一文彻底搞懂 MCP:AI 大模型的标准化工具箱
· 电商平台中订单未支付过期如何实现自动关单?
阅读排行:
· Cursor:一个让程序员“失业”的AI代码搭子
· .NET 阻止Windows关机以及阻止失败的一些原因
· 博客园2025新款「AI繁忙」系列T恤上架
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(6)
· Avalonia跨平台实战(二),Avalonia相比WPF的便利合集(一)
< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10

导航

统计

点击右上角即可分享
微信分享提示