0

I am running Windows 10 64bit and Git for Windows 2.20.1. I usually use git via Visual Studio (with mostly no problem). The only time I use git from command line is when I need to push tags.

The problem is when I type git push on Git Bash (a BASH emulation on cmd.exe), the following error message appears:

git: 'remote-Z' is not a git command. See 'git --help'.
The most similar command is
   remote-fd

as if I had typed git remote-Z. So far as I tried, any trailing options resulted in same error except for --help, which opened a local copy of "git-push(1) Manual Page" on my browser.

How do I get git push working again, or even troubleshoot this issue?

So far I rebooted system, re-installed Git for Windows (to the latest version), made sure that D:\Program Files\Git\cmd is in Path system environment value (I even put it on the top of the list), but no luck. Googling git remote-Z did not help either at this point of time.

These are the things I have checked:

  • I had checked config files (system, global, and local). None of them containd anything related to alias.
  • $ git --exec-path returns D:/Program Files/Git/mingw64/libexec/git-core. The directory is full of git executables, and I made sure git-push.exe is there.
  • What puzzles me the most, is that when I cd to local repository and run "D:\Program Files\Git\mingw64\libexec\git-core\git-push.exe" directly, the same error message git: 'remote-Z' is not a git command. appears. I made sure to re-install the whole executables but problem persists.
  • However, when I type git push outside of git repository, this message shows up: fatal: not a git repository (or any of the parent directories): .git - as if the command is working normally.
  • The repositories I use are created by Visual Studio 2015.
  • The path to local repository contain no multibyte characters, but the one to remote origin (which is on my company's network share) does. Does this matter?
3
  • What does git config --show-origin alias.push show? Commented Dec 28, 2018 at 10:38
  • Thanks.Unfortunately I can't seem to remote connect the environment where the problem is, probably due to firewall or something. I will definitely try that as soon as I'm back to my workplace. Commented Dec 30, 2018 at 2:55
  • @MichałPolitowski The command showed nothing. The result of git config -l showed neither alias.push nor remote-Z, Ditto for git config --show-origin alias.push. I guess it's unrelated to config? Commented Jan 6, 2019 at 23:51

2 Answers 2

0

Is this in one Git repository on your system or all Git repositories?

The feeling I get is somehow you set a screwed up remote on a single repo and now remote-Z (or something that would trigger those characters in some way) is in the config of the specific repo you are struggling on. This is based on what you say here:

“However, when I type git push outside of git repository, this message shows up: fatal: not a git repository (or any of the parent directories): .git - as if the command is working normally.

If you don’t get that message outside of the repository it all points to an issue with that repository’s specific Git configuration.

Check what remotes are set by running this command: git remote -v. More details on interacting with remotes can be found here. You can also manually check the config file in your .git directory at the root of the project since it’s basically just a text file. On macOS and Linux it’s in .git/config so look for something in a similar location on your Windows setup; it should show some info that can be helpful.

0

A previous comment led me to the answer. In the config file of each repository, [remote "origin"] was set like:

[remote "origin"]
    url = Z:///path\\to\\MyRepo.git

Changing the url to

    url = Z:/path/to/MyRepo.git

or

    url = Z:\\path\\to\\MyRepo.git

got everything working again, both in command line and Visual Studio. (The backslashes were automatically doubled by Visual Studio.)

IIRC I had struggled hard to create remote repository on shared network drive, and read somewhere that you need triple forward slashes after drive letter. This got things working back then, so I had configured all of my local repository like this. Not sure what had changed the behavior on git command line.

It seems to me that when the mixture of slashes above was parsed, the drive letter Z was somehow fused with [remote "origin"] right before it, resulting in remote-Z, and mysteriously deleted push I had typed. Not sure how result of parsing ended up like that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .