admin管理员组

文章数量:1122846

I am new to using GitHub Classroom and VS Codespaces for my classroom. Most of my students are able to open my assignments and commit changes with no problems. However, a few of my students receive the following error when they try to Sync or Commit their changes.

Any file edited directly on GitHub can be committed just fine. This problem only exists in Source Control on Codespaces.

[warning] [Git][config] git config failed: Failed to execute git

Additional error info On branch main Your branch and 'origin/main' have diverged, and have 2 and 2 different commits each, respectively.

Any suggestions on what the problem might be?

I even created a new assignment which opened a new Codespace, made a small change and tried to commit the changes only to receive the exact same error. Their repository remains unchanged because none of their changes are being committed.

I am new to using GitHub Classroom and VS Codespaces for my classroom. Most of my students are able to open my assignments and commit changes with no problems. However, a few of my students receive the following error when they try to Sync or Commit their changes.

Any file edited directly on GitHub can be committed just fine. This problem only exists in Source Control on Codespaces.

[warning] [Git][config] git config failed: Failed to execute git

Additional error info On branch main Your branch and 'origin/main' have diverged, and have 2 and 2 different commits each, respectively.

Any suggestions on what the problem might be?

I even created a new assignment which opened a new Codespace, made a small change and tried to commit the changes only to receive the exact same error. Their repository remains unchanged because none of their changes are being committed.

Share Improve this question asked Nov 21, 2024 at 15:46 Jonathan Leohr - AHSJonathan Leohr - AHS 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Sometimes it pays to look at the hints that Git gives you. I found this area:

 * branch            main       -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

Re-reading this and then using the following command from the CLI (accessed by Ctrl-`) this merged my divergent branches and allowed my student to commit finally.

git config pull.rebase false  # merge

I do still wonder, what did my student do to cause the divergent branches?

本文标签: githubVS Codespaces Git Sync(PushPullCommit) Has Git Config Failed ErrorStack Overflow