Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Can't pull student repos

未关闭
#77 6 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
git, go
领域
cli

调研方向

使用提供的调试输出作为参考,先执行 gh classroom clone student-repos,再执行 gh classroom pull student-repos,重现该故障。首先跟踪 git fetch upstream refs/heads/mastergit merge-base --is-ancestor 附近的 pull 路径;完成的标志是仓库能够成功更新,并且未发生变化的仓库不再报告存在分歧的更改。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

I cannot pull updates in students assignment using gh classroom pull student-repos -a ... command. It says:

failed to run gh: can't sync because there are diverging changes; use `--force` to overwrite the destination branch
. error: exit status 1

however, there are no diverging changes. It also does not work when there are no updates, as shown here:

$ gh classroom clone student-repos
? Select a classroom: XXXX
? Select an assignment: YYYY
Creating directory:  /ZZZZ-submissions
Cloning into: /ZZZZ-submissions/ZZZ-AAA
Cloning into: /ZZZZ-submissions/ZZZ-BBB
Cloned 2 repos.
 
$ gh classroom pull student-repos
? Select a classroom: XXXX
? Select an assignment: YYYY
Pulling repo: /ZZZZ-submissions/ZZZ-AAA
failed to run gh: can't sync because there are diverging changes; use `--force` to overwrite the destination branch
. error: exit status 1
Pulling repo: /ZZZZ-submissions/ZZZ-BBBB
failed to run gh: can't sync because there are diverging changes; use `--force` to overwrite the destination branch
. error: exit status 1
$ gh --version
gh version 2.52.0 (2024-07-15)
https://github.com/cli/cli/releases/tag/v2.52.0
$ gh extension list
NAME          REPO                 VERSION
gh act        nektos/gh-act        v0.2.55
gh classroom  github/gh-classroom  v0.1.14
Steps to reproduce the behavior
  1. Clone students repositories using gh classroom clone ....
  2. (Optional) Modify the reference repository and request Pull Request, accept it.
  3. Try to pull repository again
Expected vs actual behaviour

I would expect all repositories to be updated. Now I need to update them manually, which works ok (no diverging changes).

Logs

Paste the activity from your command line. Redact if needed.

$GH_DEBUG=true gh classroom pull student-repos -a AAAAAA
* Request at 2024-07-23 13:35:52.177507471 +0200 CEST m=+0.028484741
* Request to https://api.github.com/assignments/AAAAAA
* Request took 414.42728ms
Pulling repo: XXXXXX
failed to run gh: [git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2024-07-23 13:35:52.616066256 +0200 CEST m=+0.020500993
* Request to https://api.github.com/graphql
* Request took 295.087327ms
[git -c credential.helper= -c credential.helper=!"/usr/bin/gh" auth git-credential fetch -q upstream refs/heads/master]
[git rev-parse --verify refs/heads/master]
[git merge-base --is-ancestor master FETCH_HEAD]
can't sync because there are diverging changes; use `--force` to overwrite the destination branch
. error: exit status 1

The command was executed in the same directory where gh classroom clone student-repos --all was executed before.

主要语言
Go
星标
126
派生
21
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-classroom 的其他 Issue

查看 github/gh-classroom 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。