release中的token提交问题

来源:12-9 自动更新第一部分 - 自动发布 release

qq_慕先生7562333

2024-03-18

图片描述

当我在relase中使用token时报了如下错误:

git push origin master:master
remote: error: GH013: Repository rule violations found for refs/heads/master.
remote: Review all repository rules at http://github.com/linghualuan/cloud-note/rules?ref=refs%2Fheads%2Fmaster
remote:
remote: - GITHUB PUSH PROTECTION
remote: ——————————————————————————————————————————————————————
remote: Resolve the following secrets before pushing again.
remote:
remote: (?) Learn how to resolve a blocked push
remote: https://docs.github.com/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection
remote:
remote:
remote: —— GitHub Personal Access Token ——————————————————————
remote: locations:
remote: - commit: 2977457d3bb698b141d426bdf3a77501c4270a3f
remote: path: package.json:24
remote:
remote: (?) To push, remove secret from commit(s) or follow this URL to allow the secret.
remote: https://github.com/linghualuan/cloud-note/security/secret-scanning/unblock-secret/2dqwWklJCvTZOJYTfi5fM00CIVA
remote:
To github.com:linghualuan/cloud-note.git
! [remote rejected] master -> master (push declined due to repository rule violations)
error: failed to push some refs to ‘github.com:linghualuan/cloud-note.git’

这个怎么解决呢?

写回答

1回答

张轩

2024-03-18

同学你好

现在 Github 有自动检测,这种敏感信息不让提交,我们可以手动设置环境变量,同学可以参考:

在 macOS 中设置环境变量 GH_TOKEN:

打开终端应用程序。

运行以下命令,将环境变量 GH_TOKEN 设置为你的 token 值:

export GH_TOKEN=your_token_value

将 your_token_value 替换为你的实际 GitHub token 值。

环境变量 GH_TOKEN 已设置成功。你可以在终端中运行其他命令或在脚本中使用该环境变量。

Windows 的方式同学可以自己查一下,和 mac 的类似。

然后就可以在命令中就可以把前面的 cross-env GH_TOKEN=**** 删除掉了,只留下 "release": "electron-builder" 就可以了。


0
0

2024更新 Electron+React+七牛云实战跨平台桌面应用

开发一款自动云同步的 Markdown 文件管理软件

1257 学习 · 464 问题

查看课程