2

I am getting zsh: number expected whenever I`m running the following command:-

Command - git push --set-upstream origin branch_name

I`m using Oh My Zsh as my terminal in MacBook Pro with M1 chip.

I even tried another command like git push -u origin my_branch, but this also not working giving out the same error message zsh: number expected

More on use of --set-upstream here & why do we need to do it all the time is here.

4
  • I can't reproduce it with a branch named either branch_name or my_branch. Perhaps the message comes from one of your git hooks? Did you try to temporarily disable your hooks? Commented Mar 22, 2022 at 12:49
  • Have you tried put any library inside the brackets, for instance - git push --set-upstream origin resampling(asyncio) Commented Apr 22, 2022 at 10:20
  • You would have to quote the last argument, i.e. 'resampling(asyncio)', otherwise zsh takes it as filename generation flags. Commented Apr 22, 2022 at 11:24
  • Alright, I`ll try that out too. Thank you for your suggestion 👍🏻 Commented Apr 22, 2022 at 18:24

1 Answer 1

3

I got the solution for this issue:

Earlier I was running git push --set-upstream origin branch_name, with some library name in the branch name within the brackets.

For instance: git push --set-upstream origin resampling(asyncio)

What I found out is, () usually treats the content somehow differently.

And I was having zsh: number expected error as it was expecting a version number for the mentioned library.

To resolve this, I made a new branch and removed () from the branch name & the same command git push --set-upstream origin branch_name worked fine.

Hope this answer would be helpful for the community.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.