-
Notifications
You must be signed in to change notification settings - Fork 28.9k
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
Support cygwin git #7998
Comments
Duplicate of #7361. We don't support cygwin git, sorry. We've been using Git for Windows successfully in the team, complete with SSH keys, options, line ending encodings et al. What is the actual issue you get with it? |
Hmmm. So this is a dupe of a ticket that's closed because we've "just never really looked into it"? My issue is that I can use exactly the same setup with Cygwin than on Linux without having to sort out the (rather clunky) Git for Windows options and separate management of SSH keys. It's just less friction for someone who has to work routinely on both environments. Personally, I would very much like not to have to use Git for Windows at all and just rely on the Cygwin binaries. Also, you missed my suggestion of adding a |
If #7361 were open we would close this one the same way. It is a duplicate, in any case. Apologies for coming out harsh. Let me expand a bit on just never really looked into it. Code already needs to support whichever version of git you have installed in whichever platform you are using it. It is a non-trivial task that gets another complexity fold as soon as we add git flavours. We've found that Git for Windows handles the great majority of the tasks users need and I've personally have yet to find a reason that would make me use cygwin instead. Of course, I can be wrong and I'm definitely interested in someone proving me wrong. That's why I asked about the actual issue you face. If it is really something Git for Windows does not support, of course we'll reconsider our position towards cygwin, and we'll work towards that. |
It's all about integration. When you use Cygwin and its userland (bash, CLI tools, SSH, etc.), you don't need an extra terminal emulator like PuTTY, you can use standard Git plugins that rely on Perl/Python etc. seamlessly, and you don't need to set up a copy of your SSH keys anyplace else. Right now, the current (stunted and incomplete) UNIX userland clone that ships with Git for Windows doesn't provide me those affordances. Also, I can't set GIT_AUTHOR_* and GIT_COMMITTER_* on a per-repo basis using Git for Windows - it's just a surreal amount of pain to deal with that kind of thing inside it, when it all works perfectly in Cygwin. With an environment setting I might not only actually get Cygwin Git to work (I suspect it's just a matter of setting the right HOME and a few more variables) but also have GIT_* settings set on a per-project basis for me inside VS Code. And this last bit will benefit every other platform, too. |
Alright, let's keep this open for tracking the support. A PR would be much appreciated as we'll likely not have cycles to look into it any time soon. Maybe next time I'm in the Lisbon office, I'll ping you and we'll get it working in an afternoon. 😉 |
I created a symlink and it worked for me: |
@rcarmo Did you try this? |
Not yet, kind of tied up with FY16 still. Will give it a go next weekend and see if it works on my box and a fresh install (never underestimate the power of upgrades where it regards breaking things).
|
someone had a similar issue here too and it worked: #1982 |
I'm going to have a go at this (both reproducing and understanding exactly why the symlink works, and if it works with my git plugins) within the next few days and will report back.
|
Brief status update: I'm still having trouble with SSH/askpass at this point. Trying to debug. |
I've been using it alongside Cygwin, and the answer is no. Unless I go full X-Windows and run VS Code inside LXSS, I can't get the degree of integration I need (plus the LXSS console is still not as nice as mintty, but that's beside the point here) I made some headway recently using a little executable shim to wrap Cygwin's git, but I'm still missing something regarding PATH and environment variables. I still think being able to set environment variables prior to Git execution is the way around this, but time hasn't been on my side recently. |
Solution for me (Windows 10 - git from cygwin) |
That doesn't work for me for some reason - I get errors trying to find my home directory for SSH keys (Cygwin apparently gets confused and does stuff like |
I had partial success today by setting a couple of links and tweaking environment variables and managed to have Cygwin git do local commits, but there were two issues:
The second point essentially circles back to one of my earlier points - without being able to set environment variables for git within VS Code, this will likely always be broken in some way -- some people might get it to work with passwordless keys, but it's not a definitive solution. Also (and this is just an aside), getting this to partially work completely broke "regular" Windows Git (which uses a variant of Cygwin):
|
The cloud+arrow icon simply means the current branch you have checked out doesn't have an upstream branch configured. Once it does, it should show the sync icon. This must've been a coincidence that you checked out such a branch. So... would it work if you set a few env variables for when Code calls git? |
@joaomoreno: I believe so, yes. The experiment I did with an executable wrapper a while back was partially successful. Maybe something like this would be feasible:
|
And are the variables predictable for each system? Meaning, could it simply be a |
Nope, I have to set at least these for the SSH agent:
I can pin down SSH_AUTH_SOCK, but that's usually random, and I will need extra variables for some Git plugins and environments. Also, might be helpful to avoid future issues like #6202 |
Also, regarding the cloud+arrow bit, there's definitely something amiss here. I've tried Windows Git and Cygwin git on the same repo, same branch, no changes, and gotten:
Might be a version issue (Cygwin git is 2.8.3), but you're right, VSCode can't figure out the remote for some reason.
|
This is an issue between VS Code (which relies on git itself too much) and Cygwin git (which uses Cygwin directory layout, which follows POSIX FHS). |
You can create a wrapper for that in Windows batch file, which calls cygpath to output windows path, and VSCode does not have to understand cygwin path, but it still does not work perfectly. The initial Git init works, but the file listing and diff do not work. I briefly checked the VSCode before. When calling Git, it does not always use absolute path returned from Git command. It parses URI with a root path returned from other function, which does not seem to work properly with non official git binary. You can check that if you like. |
Unfortunately, VS Code tries hard to find specifically "git.EXE", even if told to use "git.sh" wrapper (which has appropriate shell association defined). |
However, a more native approach would be preferred. |
Now, I recalled why did I switch from CMD to TakeCommand/Console. |
Just adding myself here as another person who would really like to continue to use cygwin... + vscode. |
it works for me under Win 7 |
Just tried the script from Cygwin Git + VS Code compatibility and it didn't work with the following error message in Git output:
@nukata
|
@dmak Thank you! Great work, just one tiny adjustment. Either initially prefix the PATH with |
@joaomoreno Clarification: if someone were to submit a PR to fix this, would it be I'm asking because if you would conditionally accept a PR, technically, shouldn't this issue remain open? |
But why is it complicated to have git integration with VSCode? However, the editor fails to track the repositories completely. |
This is because git reporting paths unexpected to VS Code. |
src/base/common/process.ts
I was wondering if an additional check can be made here so if sandboxProcess.platform is win32, then check for a Cygwin installation, this can be checked by executing the command, In that scenario Another option might be a container, but I have no experiencie with VScode containers or extensions, but the idea is there, to be implemented. |
You can have multiple Cygwin environments installed on the same PC. And none of them in the $PATH. |
I've been using this https://github.com/nukata/cyg-git with success.
…On Sat, Apr 16, 2022 at 2:41 PM AnrDaemon ***@***.***> wrote:
You can have multiple Cygwin environments installed on the same PC. And
none of them in the $PATH.
I've long since abandoned the hope and installed Git-for-Windows (and told
VS Code to use specifically that one).
—
Reply to this email directly, view it on GitHub
<#7998 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADM6ZK73Q6EIR2CQEYNIWVLVFKYPZANCNFSM4CHOZKKQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
as noted in #148720 i believe supporting the configured integrated terminal is the way to go. extensions like gitlense do this e.g. |
This is not enough. |
Vscode could have Git auto-detection for Windows from different sources:
It may be hardcoded preference or highest version preferred. |
Yet again - this is not about git.exe location, it is about Cygwin paths support. |
Yes, I got it @AnrDaemon |
Yes, you could. That's not the problem. It requires some extra care inside VS Code itself, and even then not fully fool proof, as other extensions may run Git directly by themselves. |
@AnrDaemon Yep. it's not just the difference in slashes, absolute paths and cygwin start with Here's my workaround, and I didn't come up with it on my own. In fact, I may be summarizing something already in this thread.
I'm kind of in a rush so I don't have the time to verify if these are the only steps, but it is what I currently use. I hope this can be of help to someone. I want to reiterate that @AnrDaemon 's last paragraph still applies. |
The workaround is to install Git-For-Windows in a separate directory and point VS Code to it. |
Are providing an alternative workaround or explaining mine? |
Restating the obvious. |
Not obvious enough, it seems. It looks like you said this back in 2022, but I hadn't noticed until now. The next reply provides a different workaround that may have buried yours. If you use the git-for-windows work around, can you still use cygwin's |
I do. Cygwin is my go-to *NIX tools, I only install native ports/equivalent tools when one of the following statements is true:
|
Steps to Reproduce:
git.path
to point to"\\cygwin64\\bin\\git.exe
ENOENT: no such file or directory, lstat 'C:\cygdrive'
, as described hereThis is, of course, because Cygwin namespaces the filesystem differently. However, doing this (which usually fixes things in other tools):
...then results in further confusion as Code apparently does not have a way to correctly set the environment for the git process, which then defaults to the wrong PATH:
Trying to set PATH, HOME, etc. inline in the
bash
command line above fails for some reason I cannot yet fathom, but I would suggest a configuration settinggit.env
be created so that the environment external Git tools can be pre-configured (this would also benefit the Linux and OSX ports).As to why this is necessary and why I can't use other Git binaries on Windows, the reason is simple:
Cygwin does Git over SSH "right", with completely identical setup in terms of SSH keys, options, CR/LF encoding, etc. Current Git for Windows simply does not work for my use case (I've tried), and, obviously, the Linux Subsystem doesn't help with this either.
The text was updated successfully, but these errors were encountered: