Open SukkaW opened 5 years ago
Do you have git installed and where is it installed? "which git"
@glvr182 Yes, without any doubt.
$ which git
/usr/bin/git
Now I have to add lazygit ubuntu ppa to my WLinux(based on Debian) and install from apt, then everything works correctly...
@SukkaW Where there any other problems outside of the git fetch, pull and push not working?
If so it might be related to the new way fetch, pull and push works.
@mjarkk I had tried to switch to branch panel and used n to create a new branch, it works. I had also tried to switch to commit panel, tried rename commit and squash the commit into previous one, they both work, too.
@mjarkk It seems like problems do be related to the fetch, pull and push.
Find a similar problems related to git in another go project. https://github.com/fatih/vim-go/issues/1473
From this issue: https://github.com/golang/go/issues/17365 and from a lot of other small issues/comments it seems like this is a problem with the windows subsystem not doing what it is supposed to do.
If it's true what i'm thinking it's not possible to use git in a pty on windows WSL.
@mjarkk
At least I managed to add Ubuntu PPA to my Debian based WSL and then I am now able to install usable lazygit
through apt.
I'm confused why that made it work maybe git in ubuntu is different than in debian
Sadly i currently don't time to investigate this deeply on a windows pc.
But i found something that might be handy to overcome this.
Because this and windows in general have problems with running git in a PTY (windows due to the shitty support for PTYs and the Debian sub system for the broken git version that does not seem to not work on a PTY)
it would be nice if there is a way to bypass the PTY part.
So after some googling why git bash pops up a credentials input box i found out there is a shell variable(s) to show a credentials popup.
This popup:
The shell variables are:
Var | Tested | Source |
---|---|---|
GIT_ASKPASS |
Nope | https://github.com/git/git/blob/master/t/lib-credential.sh#L305 |
HTTPS_ASKPASS |
Nope | http://git.661346.n2.nabble.com/http-getpass-function-in-msysgit-td4505330.html#none |
SSH_ASKPASS |
Yes (I've removed the shell variable and it didn't show the popup) | https://github.com/openssh/openssh-portable/blob/master/contrib/redhat/gnome-ssh-askpass.sh |
I've no idea how they works but my guess is that they call that program for credentials and use the output as credentials.
It would be cool if there is a lazygit config item / shell var where you could enable git asking lazygit for credentials in staid of reading the output of a pty.
How it would work:
... _ASKPASS=lazygit
to a normal go execLG_GITASKPASS_PROXY
@mjarkk I have installed the latest daily build of lazygit from PPA, and now the same issue happened again.
$ lg -v
commit=3a60706, build date=2019-01-18, build source=debian, version=, os=linux, arch=amd64
It is nothing related to platform, system or go. I think if the lazygit I installed from PPA or the lazygit I installed through go get
have the same error, it means the issue came from lazygit itself.
Thanks for testing this again if i find some time this week i'll investigate this deeper.
I also don't think this has something to do with the PPA,
Although this might have something to do with git running in a PTY, the win subsystem has known kernel problems if that's the case this might be hard to fix.
@mjarkk The problem is the previous version of lazygit (from PPA) works fine but the latest version (from PPA as well) has the error. So the issue might related to some commits between two builds, isn't it?
You have this because of this pull: https://github.com/jesseduffield/lazygit/pull/309
That was merged in recently. It changed the way git fetch, push and pull work this is dune because lazygit broke before this pull when git pull or push asked for a username or password.
The short is that git push, pull and fetch now use a PTY in-staid of a TTY. (That was needed to solve the above problem)
Because the emulated Linux kernel on windows has known problems and PTYs are one of them i'm thinking this is a low level problem that we can't solve because there is no direct solution.
@mjarkk Speaking about git password problem, I think netrc
file could be a solution. It can keep git username and password and git will read that file without ask for a username or password. netrc
file not only works on git but also SSH.
In windows it could be C:\Users\[Username]\_netrc
and in Unix based system it could be ~/.netrc
.
I was having a password problem before and I solved it with keeping my git username and password in netrc
file.
Hmmm i think it's not a great idea to tell a user there is a bug in the default functionality of a program. Yes there is a workaround but i'm NOT going to store my password in raw text or always select the ssh link for a git clone.
Lazygit could also add stuff to that file but a user might not know it's happening what would not be not great for the security of this program it also could overwrite a user config or add data someone doesn't want to be in there.
What we could do is check for a shell var something like LG_NO_PTY
and if that's set we don't use a pty that would result in not beadle to check for credentials but would solve your problem.
Although that would solve this and some other problems it is far from perfect. A better way to do this would be what I've earlier send in this issue.
Git can also ask a program for credentials if it needs to (this doesn't require the use of a PTY). Git could ask Lazygit for credentials and if Lazygit detects it is ran from git it asks the main process for credentials what (this would also solve the windows fallback), see https://github.com/jesseduffield/lazygit/issues/360#issuecomment-452610031 for the full explanation.
But i still need to take a look into the code, it might be just a solvable code error.
@mjarkk Thanks for your reply! A workaround should be perfect.
@SukkaW Today i tried to reproduce your problem but everything seems to work fine.
Here is what i did.
windows 10 64bit pro
in a VM (Windows 10 October 2018 Update) sudo su
apt update && apt upgrade
apt install git
/root
(i've tested a private and public repo)Did i miss something here?
@mjarkk
How do you install lazygit
? Using go get
or apt
?
And every operation I have done was not under root user (using sudo
directly instead of sudo su
).
$ lg -v
commit=3a60706, build date=2019-01-18, build source=debian, version=, os=linux, arch=amd64
This is the lazygit I am using now, BTW.
It was a build from source on my Linux machine that i've copied over to the windows vm.
And what is your git version?
Found it!
If i run this as root user it works if i run this as normal user it doesn't work.
This might be fixable!
@mjarkk Yeah, I found it as well!
Update.
This problem is somewhat related to https://github.com/kr/pty (we use that package to run git fetch, push, pull in a pty).
I've just tested the package with a simple binary that just runs ls -a
using that package and it gives this error: fork/exec /usr/bin/ls: invalid arguments
and this is only the case if i run it as normal user, running it as root user work perfectly fine
I can also confirm that this is the case with all windows subsystems: Ubuntu, debian, openSuse, etc
Describe the bug
I reinstall
lazygit
usinggo get
as my reinstallation of WSL. Then I start usinglazygit
, I got this when I try to use p to pull, or Shift + P to push.To Reproduce
Steps to reproduce the behavior:
cd
to a repofork/exec /usr/bin/git: invalid argument
Desktop (please complete the following information):
I then run
go clean -i github.com/jesseduffield/lazygit && go get github.com/jesseduffield/lazygit
to make sure I have installed the latest version oflazygit