Github 使用介绍

发布时间: 更新时间: 总字数:585 阅读时间:2m 作者: 分享 复制网址

Github 使用介绍

相关网站

基础使用

配置 sshkey

参考 SSH 常用命令

  • 创建 sshkey
ssh-keygen -t rsa -C "邮箱"
  • 在 Github 中添加公钥

复制 ~\.ssh\id_rsa.pub 文件中的内容,登录 Github –> Account Setting –> SSH-KEY –> Add SSH-KEY –> 粘贴id_rsa.pub中的内容

  • 验证
ssh -T git@github.com
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

说明配置成功,可以连接上 Github

Fork仓库

点击仓库右上角的Fork后,选择需要放到的org即可。

保证代码同步

git clone这个fork的项目

git clone <fork url>
git remote add <name> <ori url>

# 更新 "指定" remote 底下的分支
git fetch <name> <branch>

# 更新多个 remote 底下的分支
git remote update
## 或者
git fetch --all

# 保持同步
git pull --rebase <remote> <branch>
## 等同于以下两条命令
git fetch <remote> <branch>
git rebase <remote>/<branch>

pull request

Github上的许多开源项目使用pull request进行代码review和讨论。

pull request有2种类型:

  • 对一个forked仓库进行pull request
  • 对一个仓库里的分支进行pull request

issue

github使用issue追踪需求和修复bug。

  • 管理人创建issue模版
  • 使用者可以根据模版提交issue
  • issue可以添加tag、分配、订阅等动作

创建分支

贡献者创建一个自己的新分支,在该分支上进行操作,最后通过pull request方式合并到主分支上。命令如下:

git checkout -b feature_x
git push --set-upstream origin <分支名>

Git commit 规范

Git commit 规范

创建github app

https://github.com/settings/applications/new 注册 Github APP,并获取和配置

  • OAuth2 client ID
  • OAuth2 client Secret
  • callback url
  • 登录的用户,需要在某个组织中,示例为 beehat 组织,test teams

CI

Github 第三方扩展

参考

  1. https://github.com/actions/starter-workflows/tree/master/ci
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数