手工授权bloom创建github上的ros发行版PRs

如果你为github启用了双因素身份验证,bloom就不能仅使用你的github密码登录。有两步需要进行:

  1. 在github上创建一个个人访问令牌,并告诉bloom,这一步pull-request将会用到。
  2. 通过ssh重新路由https传输(假设启用了公钥身份验证)。(这只会支持git的push和pull,而不是拉请求打开)

基于令牌的身份验证

创建一个访问令牌

到github网站登录。打开设置页面,找到开发者设置点击左侧菜单中的 "Personal access tokens"

点击"Generate new token"按钮,并按照说明操作。确保在repo子树下授予"public_repo"授权。将描述设置为"Bloom token"。在您创建了令牌之后,你将返回到"Personal access tokens"页面。新标记将用绿色突出显示。将字母数字标记复制到剪贴板。

使用令牌配置bloom

在编辑器中打开~/.config/bloom。如果不存在,创建它。输入以下内容:

  • {
        "github_user": "<your-github-username>",
        "oauth_token": "<token-you-created-for-bloom>"
    }

填写你的用户名和你在前面步骤中所做的标记。保存文件。从现在开始,bloom应该能够在你发布版本时自动创建对ros发行版的pull请求。

在发布时,你可能仍然会看到Bloom对用户名/密码的请求。如果是这样,下一步就是重定向https请求,以使用你的ssh身份验证来进行存储库的pull和push。

通过ssh重路由https

这里作为建议,你还可以通过编辑你的.gitconfig文件重新路由bloom的https流量。

# Always use ssh for github, even if the remote URL uses https or git
[url "git@github.com:"]
  insteadOf = git://github.com/
[url "git@github.com:"]
  insteadOf = https://github.com/

注意,如果你选择了这个选项,一定不要忘记。 使能ssh连接`github`.

用于设置OAuth令牌的Bash脚本

如果你使用计算机的自动安装脚本,你可能会发现这个脚本很有用:

# Install Bloom Github oauth access token for releasing ROS packages
function installros_github_token() {
read -p "Your Github username: " userName
read -p "A Github oauth token for your account: " oAuthToken
rm -f $HOME/.config/bloom
cat <<EOF >> $HOME/.config/bloom
{
    "github_user": "$userName",
    "oauth_token": "$oAuthToken"
}
EOF
}

Wiki: cn/bloom/Tutorials/GithubManualAuthorization (last edited 2018-08-10 00:29:21 by Playfish)