0

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.

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.