lab icon indicating copy to clipboard operation
lab copied to clipboard

"Failed collect git remove infos. exit status 128."

Open PhilipRoman opened this issue 5 years ago • 8 comments

I installed the binary but any sub-command (other than simply typing "lab") will show this error message: Failed collect git remove infos. exit status 128. . Git is installed and works correctly. I am using Windows Subsystem for Linux.

PhilipRoman avatar Sep 18 '18 16:09 PhilipRoman

Thank you for contributing !!!

Failed collect git remove infos. exit status 128.

This error is caused by do git remote failing. Please move to the error repository on your console and confirm that you can do git remote.

Unfortunately I do not have Windows so I can not reproduce your error. I need your cooperation to resolve this error.

Of course you are also welcome to pull request.

lighttiger2505 avatar Sep 18 '18 17:09 lighttiger2505

I added code for error tracking of Git command with this commit. If you install and run this release binary you can see more detailed error.

Reinstallation can be done by executing the command below.

curl -s https://raw.githubusercontent.com/lighttiger2505/lab/master/install.sh | bash

lighttiger2505 avatar Sep 18 '18 17:09 lighttiger2505

Okay, I think I have this figured out.

My Windows file system is mounted on /mnt/c A long time ago I noticed that git from linux has trouble with files within /mnt/c but git.exe from windows could not access files unless they were in /mnt/c. I solved this by aliasing git to `if inwindows; then echo git.exe; else echo git; fi` - choosing between git and git.exe depending on current directory.

Now, lab obviously calls git without doing any shell expansions and thus it fails when inside /mnt/c. For the record, here is the error: fatal: Could not chdir to 'C:/Users/usr/xxx: No such file or directory.

Solution

There should be some way of configuring the git command that is called, maybe an env variable or command line option (something like alias lab='lab --git-cmd=...')?

Unfortunately I'm not too familiar with Go so I can't PR.

Also, thank you for the commit - I never would've figured it out without it!

PhilipRoman avatar Sep 19 '18 14:09 PhilipRoman

Please let me check.

  1. Running the lab on a windows file system(/mnt/c) results in an error. Because git is executed instead of git.exe which should be aliased.
  2. Running the lab on a linux file system(Other mnt/c) results in an success.

OK ?

lighttiger2505 avatar Sep 20 '18 05:09 lighttiger2505

There should be some way of configuring the git command that is called, maybe an env variable or command line option (something like alias lab='lab --git-cmd=...')?

I appreciate your suggestion.

But I think your case is special. I think that it is better to use the git command in an appropriate place rather than using it differently depending on the location.

If possible we want you to use lab on the linux file system.

lighttiger2505 avatar Sep 20 '18 05:09 lighttiger2505

Yeah, lab works good outside of /mnt/c. Unfortunately I can't move the repo to the linux file system. Even if this is an edge case, I don't think that option to choose custom git command would be difficult to implement or maintain. If not, I can always fork this, implement the patch and use my own forked version. Thank you for helping me resolve this!

PhilipRoman avatar Sep 20 '18 09:09 PhilipRoman

Hmmm...

I was thinking about adding --git-cmd option, but I thought it would be bad to add specific environment dependent options. Because the git command does not need to switch at all in a general unix/linux environment.

I may not start with this issue at once, but I would like to think about other methods.

lighttiger2505 avatar Sep 22 '18 14:09 lighttiger2505

Actually I guess I should just rename git to git-real and create my own script called git. This should be a fairly robust solution.

PhilipRoman avatar Sep 22 '18 14:09 PhilipRoman