Github 使用技巧
前言
因为最近手头上的东西很多,要最快的在很短的时间内完成一个项目,需要多多参考别人的优秀的代码。很多东西,在github 上都开源了,反复造轮子浪费时间,用好别人东西才是最高效的方法。
瞎逛逛
- GitHub Trend 页面总结了每天/每周/每月周期的热门 Repositories 和 Developers,你可以看到在某个周期处于热门状态的开发项目和开发者。
- GitHub Topic 展示了最新和最流行的讨论主题,在这里你不仅能够看到开发项目,还能看到更多非开发技术的讨论主题,比如 Job、Chrome 浏览器等。
搜索技巧
in:name xx //搜索名字中带有"xx"的
in:readme xx //搜索readme中带有"xx"的
in:description xx //搜索描述中带有"xx"的
stars:>1000 //搜索stars>1000的
forks:>1000 //搜索forks>1000的
pushed:>2019-09-01 //搜索最近更新于2019年9月1日之后的
language:xx //搜索xx的项目
pushed:>2019-09-01 //2019年9月1日后有更新的
language:java //用Java编写的项目
user:ppsteven forks:>100 //ppsteven用户下forks>100 的项目
Github Template
Github Template 是Github上的项目模板,可以直接点击 Use this template 去使用,直接搜索搜索不到,需要使用Google检索 <search word> site:github.com "Public template"
有影响力的项目
- free-programming-books:整理了所有和编程相关的免费书籍,同时也有 中文版项目。
- github-cheat-sheet:集合了使用 GitHub 的各种技巧。
- 后续会逐步更新添加
Github项目推送
从2021年8月13日以后,不再支持用户名密码的方式验证了,需要使用个人访问令牌(personal access token)
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/<USERNAME>/<REPO>.git': The requested URL returned error: 403
第一步:生成 Personal access tokens
GitHub -> Settings -> Develop settings -> Personal access tokens -> Generate new token
第二步:使用token推送项目
1)将 GITHUB_TOKEN 添加进 ~/.zshrc
,设置为环境变量
export GITHUB_TOKEN="ghp_jIznXkhj23syADRxStLU4nrExxxxxxxxxx"
2)修改现有项目url
$ git remote set-url origin https://$GITHUB_TOKEN@github.com/PPsteven/<repo.git>
或者在填写密码时使用GITHUB_TOKEN,也可推送成功