Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't clone repo: Got unexpected extra argument #4131

Closed
DanielBustillos opened this issue Aug 14, 2021 · 13 comments
Closed

Can't clone repo: Got unexpected extra argument #4131

DanielBustillos opened this issue Aug 14, 2021 · 13 comments
Labels
bug Something isn't working

Comments

@DanielBustillos
Copy link

Describe the bug

I cannot clone any repo with cli. Installed via homebrew in Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1021-aws x86_64). gh --version doesn't work for me.

Steps to reproduce the behavior

  1. Type this:

gh repo clone cli/cli

  1. View the output/error

Usage: gh repo [OPTIONS] USER_REPO
Error:` Got unexpected extra argument (cli/cli)

Expected vs actual behavior

I would have expected to get the repo cloned, but I keep receiving that message.

@DanielBustillos DanielBustillos added the bug Something isn't working label Aug 14, 2021
@shaharyarahmed-bot
Copy link
Contributor

shaharyarahmed-bot commented Aug 14, 2021

I am running a Arch Linux x86_64 system and using gh version 1.14.0. I tried to reproduce the error, however the repository got cloned successfully. Try updating your cli, or try installing it through the ubuntu apt package manager.

@mislav
Copy link
Contributor

mislav commented Aug 16, 2021

@DanielBustillos What you got installed as gh on your system is not GitHub CLI. The usage line of our own command looks like this:

Usage:  gh repo clone <repository> [<directory>] [-- <gitflags>...]

@mislav mislav closed this as completed Aug 16, 2021
@DanielBustillos
Copy link
Author

DanielBustillos commented Aug 19, 2021

I followed the brew installation guide, is this not a security issue?

@mislav
Copy link
Contributor

mislav commented Aug 19, 2021

@DanielBustillos Are you saying that you've done brew install gh, but when you type gh you get a different tool?

Can you tell us the output of gh --help, type gh, and which -a gh?

@mislav mislav reopened this Aug 19, 2021
@mislav
Copy link
Contributor

mislav commented Aug 30, 2021

Closed due to lack of information.

@mislav mislav closed this as completed Aug 30, 2021
@stuartstein777
Copy link

I got this error message today after thinking I had successfully installed the github cli .deb)

Turned out that it wasn't actually installing and I had another tool (gitsome) installed. Gitsome was running when I was entering $ gh at the command line, not the github CLI.

When I try to install the .deb it fails, but fails silently which can make it look like its installed fine. I got around this by removing gitsome

$ sudo apt remove gitsome

Then installing the gh CLI worked. Then gh command ran the github CLI fine.

@GPrathap
Copy link

I just had the same issue and was able to resolve it as @stuartstein777 mentioned, here is where installed gh https://github.com/cli/cli/blob/trunk/docs/install_linux.md

@JorgeFlorezC
Copy link

I got this error message today after thinking I had successfully installed the github cli .deb)

Turned out that it wasn't actually installing and I had another tool (gitsome) installed. Gitsome was running when I was entering $ gh at the command line, not the github CLI.

When I try to install the .deb it fails, but fails silently which can make it look like its installed fine. I got around this by removing gitsome

$ sudo apt remove gitsome

Then installing the gh CLI worked. Then gh command ran the github CLI fine.

remove gitsome works for me

@novusli
Copy link

novusli commented Oct 23, 2022

I have the same issue in macOS 12.6.

I installed the GitHub Cli with brew brew install gh. Then I tried gh repo clone <user_name>/<repo_name> from my repo, and it shows
Usage: gh repo [OPTIONS] USER_REPO Try 'gh repo --help' for help. Error: Got unexpected extra argument (<user_name>/<repo_name>)

gh --help shows
Usage: gh [OPTIONS] COMMAND [ARGS]... Main entry point for GitHubCli. :type ctx: :class:click.core.Context:param ctx: An instance of click.core.Context that stores an instance ofgithub.GitHub. Options: --help Show this message and exit. Commands: configure Configure gitsome. ...

type gh shows
gh is /Users/<user_name>/anaconda3/bin/gh

which -a gh shows
/Users/<user_name>/anaconda3/bin/gh /usr/local/bin/gh /usr/local/bin/gh

I tried the remove gitsome mwethod but it shows that I don't have the gitsome installed.

Any solutions?

@mislav
Copy link
Contributor

mislav commented Oct 24, 2022

@novusli What you have installed as gh is not GitHub CLI, since the output of gh --help is unrecognizable to me. This is what you should be getting instead:

$  gh --help
Work seamlessly with GitHub from the command line.

USAGE
  gh <command> <subcommand> [flags]

...

It's likely that /usr/local/bin/gh on your system is the true GitHub CLI, but /Users/<user_name>/anaconda3/bin/gh takes precedence over it. Figure out what installed that and remove it.

@novusli
Copy link

novusli commented Oct 24, 2022

@novusli What you have installed as gh is not GitHub CLI, since the output of gh --help is unrecognizable to me. This is what you should be getting instead:

$  gh --help
Work seamlessly with GitHub from the command line.

USAGE
  gh <command> <subcommand> [flags]

...

It's likely that /usr/local/bin/gh on your system is the true GitHub CLI, but /Users/<user_name>/anaconda3/bin/gh takes precedence over it. Figure out what installed that and remove it.

It works after I removed the /Users/<user_name>/anaconda3/bin/gh. Thanks!

@nighanxiety
Copy link

I fell into this same trap with gitsome while setting up git on my WSL Ubuntu distribution. When I tried to run a gh repo clone ... command without either installed, I got the message:

Command 'gh' not found, but can be installed with:

sudo apt install gitsome

Which installs this github repository: https://github.com/donnemartin/gitsome

The help text for gh --help after it is installed looks legit, as it says:

Usage: gh [OPTIONS] COMMAND [ARGS]...

  Main entry point for GitHubCli.

  :type ctx: :class:`click.core.Context` :param ctx: An instance of
  click.core.Context that stores an instance     of `github.GitHub`.
   ...

I then repeated had the problem where gh repo clone user/repo reported an extra argument, while gh repo clone would of course tell me it was expecting another user/repo argument.

The gitsome repository has an open issue about the name conflict (as it was also on the Debian issues list, but the repository has had no updates since 2019, and has several pending pull requests, so it seems unlikely the owner is likely to resolve this issue anytime soon.

@MaxenceA4
Copy link

Hello guys, new on Linux here, what is the correct way to install the gitsome apt then ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants