remote: Permission to xxx/xxx.github.io.git denied to github-actions[bot]. fatal: unable to access 'https://github.com/xxx/xxx.github.io.git/': The requested URL returned error: 403
Fetched in submodule path 'themes/even', but it did not contain xxx. Direct fetching of that commit failed.
原因: 在子模块中做了修改但没有推送到远程
教训: 不要修改第三方主题仓库的代码!
坑 7:双仓库部署的权限噩梦(血的教训!)
在采用同一个仓库、不同分支的方案之前,我踩过更大的坑——分两个 GitHub 仓库部署:
一个 private 私有仓库 存放 Hexo 源码
一个 public 公开仓库(即 homleening.github.io)存放生成的静态文件
方案设想
1 2 3 4 5 6 7 8 9
private 仓库 (源码) public 仓库 (静态文件) main 分支 main 分支 ├── source/ ├── index.html ├── themes/ ├── css/ └── _config.yml └── js/ │ ▲ │ GitHub Actions 自动部署 │ └──────────────────────────────────────────┘ 编译生成 → 推送到 public 仓库
遇到的问题
1. 默认 GITHUB_TOKEN 权限不足
GitHub Actions 默认的 GITHUB_TOKEN只能作用于当前仓库,无法推送到其他仓库(无论是 public 还是 private)。
2. 403 权限错误
1 2
remote: Permission to homleening/homleening.github.io.git denied to github-actions[bot]. fatal: unable to access 'https://github.com/homleening/homleening.github.io.git/': The requested URL returned error: 403
3. Fork 工作流也行不通
即使是 Fork 关系,跨仓库的自动部署依然受 Token 权限限制。
尝试过的方案
方案一:使用 Deploy Key
为 public 仓库配置 SSH Deploy Key
在 private 仓库的 Secrets 中添加私钥
问题:需要精细管理密钥对,每次更换密钥都麻烦
问题:没有 fine-grained 权限控制
方案二:使用 GITHUB_TOKEN + 手动触发
不行!GITHUB_TOKEN 跨仓库天然受限
方案三:创建 Personal Access Token (PAT)
在 GitHub Settings → Developer settings → Personal access tokens
You, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge cavern, which consists of many rooms connected with tunnels. Each room is occupied by some bugs, and their brains hide in some of the rooms. Scientists have just developed a new weapon and want to experiment it on some brains. Your task is to destroy the whole base, and capture as many brains as possible.
To kill all the bugs is always easier than to capture their brains. A map is drawn for you, with all the rooms marked by the amount of bugs inside, and the possibility of containing a brain. The cavern’s structure is like a tree in such a way that there is one unique path leading to each room from the entrance. To finish the battle as soon as possible, you do not want to wait for the troopers to clear a room before advancing to the next one, instead you have to leave some troopers at each room passed to fight all the bugs inside. The troopers never re-enter a room where they have visited before.
A starship trooper can fight against 20 bugs. Since you do not have enough troopers, you can only take some of the rooms and let the nerve gas do the rest of the job. At the mean time, you should maximize the possibility of capturing a brain. To simplify the problem, just maximize the sum of all the possibilities of containing brains for the taken rooms. Making such a plan is a difficult job. You need the help of a computer.
Input
The input contains several test cases. The first line of each test case contains two integers N (0 < N <= 100) and M (0 <= M <= 100), which are the number of rooms in the cavern and the number of starship troopers you have, respectively. The following N lines give the description of the rooms. Each line contains two non-negative integers – the amount of bugs inside and the possibility of containing a brain, respectively. The next N - 1 lines give the description of tunnels. Each tunnel is described by two integers, which are the indices of the two rooms it connects. Rooms are numbered from 1 and room 1 is the entrance to the cavern.
The last test case is followed by two -1’s.
Output
For each test case, print on a single line the maximum sum of all the possibilities of containing brains for the taken rooms.