Git rebase main - fatal: invalid upstream 'main

Hi together,

I started the learn-git-by-building-an-sql-reference-object and in the lesson of the rebase main the command to insert in the terminal doesn’t work.

When I insert the, as suggested, “git rebase main” this is the error “fatal: invalid upstream ‘main’”

Here is the screenshot of the error:

What do I do? Somebody can explain the error?


Run “git branch” to see if main still exists. Maybe you deleted it?

No. I already checked with all commands learned in this course.


if you only have the main branch, what are you rebasing to?

Example if you have 2 branches (main and test) you can do git rebase main on the test branch to pull those commits from main in.

it looks like you may have deleted the branch you were on
You probably have to go back some steps and recreate it and redo the changes etc.

Ok. The branch test is feat/add-column-references.

So, the branch test “feat/add-column-references” exists it looks like the commit doesn’t work.

The previous lessons make me create the feat and commit.

what does “git -log” say?
(perhaps you have this commit there?)

git log say “fatal: your current branch ‘feat/add-column-references’ does not have any commits yet”

I am out of ideas. The only thing left that I know of is the ‘nuclear option’ where you remove the entire container in codeally’s dashboard and start the whole thing from scratch.

actually maybe one more thought.
I notice you have a
I don’t remember creating that when I went thru the course.
Is that something you made based on the steps given?

I found the instructions for the
I believe you are trying to skip steps because the commit message you are using doesn’t match the one that was used for creating these two files which was

git commit -m "Initial commit".

It really might be better to delete this container and start again because you may make other mistakes and there is no guarantee that any of this patching up will work…

It’s strange, in order to go to the next lesson the command must be correct.

Anyway, ok, I will start the course again.

Thank you hbar1st

I did this one yesterday just to test it and it all worked for me. But that obviously doesn’t mean something can’t go wrong.

Not sure how it handles a soft reset with the git challenges. But it might be worth a try if you encounter any issues (at least before restarting from the top).

Top left menu > Project options > Soft reset

I have tried the soft reset and it won’t undo several steps back. (Which is the issue here, the branch and the changes were deleted).

I just mean when you are at a step using it to go back to the previous state.

I’m just a little confused about how the challenge can end up in the state it was, twice it seems. @gabrielemorini Are you issuing commands other than what is asked for?

@lasjorg No. Just the commands learned in previous lessons, like the screenshot above.

I have tried the “nuclear option”: restoring the tutorial, but even this option does not work.

Restoring leaves the old folders and when I try to solve Level 2 the problem is still the same:

It doesn’t seem to read the command.

I have also tried sign in/sign out and clearing the cache.

@lasjorg @hbar1st Can I make any other attempt to restart the course without any problems?

By nuclear I meant to delete the container from codeally dashboard.

Instructions here under the last resort option (you must create a codeally account first)

Okay, now I have rebooted correctly.

Thanks for the help!

1 Like