GM 脚本:修正 github
从某时起,Github 和 Linux 一样,开始有着越来越多的 bug 和让人不舒服的地方。本文所附的 GreaseMonkey 脚本修正以下问题:
- 项目首页默认下载文件格式是 zip 而不是 gzip。
- 新建项目后,从已有项目创建的提示命令使用 HTTPS 而不再是 SSH 协议。这直接导致 git 向用户询问用户名和密码,而不使用用户已经上传并确认的密钥。
Google Code 后来也加入了 git 支持,但是我极少使用。为什么呢?因为我讨厌输入用户名和密码!虽然 Github 没有像 Google Code 那样给你生成个随机密码,但这种麻烦且不安全的方式能避免我就决不容忍。你的密码会比密钥还长吗?你使用密钥时需要输入或者显示密钥的内容吗??
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 | // ==UserScript==// @name github fixes// @namespace http://lilydjwg.is-programmer.com/ // @description 下载默认 gzip 格式,新建项目时使用 ssh 协议// @include https://github.com/*// @grant none// ==/UserScript== var dl = document.querySelector('[icon_class=mini-icon-download]');if(dl){ dl.title = dl.title.replace('zip', 'gzip'); dl.href = dl.href.replace('/zipball/', '/tarball/'); dl.childNodes[1].textContent = 'GZIP';}var repourl = document.querySelectorAll('.js-live-clone-url');var re = /https:\/\/github\.com\/([^\/]+)\/(.*)/;var span, m;var i, len;for(i=0, len=repourl.length; i<len; i++){ span = repourl[i]; m = re.exec(span.textContent); if(m){ span.textContent = 'git@github.com:'+m[1]+'/'+m[2]; }} |
点此安装。
2012年9月9日更新:跟随 github 的更新,修正修改默认下载的格式失败的问题。
浙公网安备 33010602011771号