Android Studio Path to Git executable - windows

I'm developing on windows but have installed Bash for Windows (basically a Unix terminal for those who don't know about Windows 10 anniversary update). I installed git through this terminal (sudo apt-get install git) as opposed to downloading it as a Windows application from GitHub.
I'm now trying to integrate Git into Android Studio, and it's asking for a path to the Git executable. Because I didn't download it as a Windows application, there is no .exe, and instead I've tried to give the path C:\Users\Faizan\AppData\Local\lxss\rootfs\usr\bin\git which is where the terminal tells me where Git is when I type type git. I didn't really expect this to work because it's not an .exe but I'm stuck on ideas from here.
How can I make this work without having to download Git for Windows? How do people who develop on Unix systems deal with this path as they don't have an executable file either?

You still have to download Git For Windows.
Try the portable edition: PortableGit-2.10.0-64-bit.7z.exe
It comes with a bash, but even without opening a bash, you sttill have (in a regular Windows CMD session) 200+ Linux commands in <yourGit2.10>\usr\bin.
And of course, it has a git.exe, which is what your Android Studio needs.

Related

How to Uninstall Git for Windows SDK?

Git for Windows SDK apparently uses over 5.25GB of disk space and I have no use for developer kit bloat. Now I want to uninstall but I could not find any instructions online or in documentation. On Windows 7 after install there is no uninstall.exe and no uninstall listing in Programs list. Everything seems to be under the directory:
c:\git-sdk-64
So I would just delete that directory.
I don't see any additions to the Windows path that seem to relate to the Git for Windows SDK.
My basic goal is just to use AVRdude and AVR Toolchain for Windows under windows 7 as described in the instructions here:
https://www.pololu.com/docs/0J67/5.5
where I need Msys2 with pacman to install AVRdude, and I would install tree command, and I want to use a Linux command environment on Windows and Linux to develop AVR Programming resources in a cross platform manner. Any advice from experience would be appreciated since I don't want to pollute my Windows 7.
EDIT - Using windows file explorer, right click on sdk folder, properties, size shown is 5.49GB on disk. I don't see any links installed in the Program menu and I doubt there are other files installed anywhere else. So I am just going to delete this whole folder.
When first installed, the console prompt a clonning action from the github repository. Furthermore, the path choose has a .git folder in it where current status and branches can be seen through command line (with git status).
I havent' seen or ask for the code of the executable, as it might link or copy to other paths, but to me it's very probable it just downloads the github repo and compiles some executables (as files are not exactly the same as in the repo).
The only thing to care is the link created to desktop.

How to add git to PATH (Bash on Windows)

I am using Bash on Ubuntu on Windows, and I installed git. How do I add git to my PATH?
The General command is (using setx):
setx PATH=%PATH%;C:\path\to\Git\bin
On WSL (Windows Subsytem for Linux), you would type, after installation:
which git
It should be already in your PATH (/usr/bin or /usr/local/bin)
If it is not, you can try and find it: find / -name "git", and add it to your ~/.profile with:
export PATH=$PATH:/path/to/git
But be aware the WSL will install an old version of Git.
Fir the most recent one, use:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git-core
Where is /usr/local/bin on Windows?
As mentioned in BashOnWindows issue 402:
Under C:\Users\**user**\AppData\Local\lxss, You will find:
root folder
home folder
and a hidden rootfs folder (\bin, \boot, \dev, \etc...)
DON'T CHANGE ANYTHINK INSIDE! SERIOUSLY! 🚨
Access Windows files via /mnt/**letter**/
And:
Maybe I don't fully understand what Bash on Ubuntu on Windows is.
See Wikipedia WSL entry:
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10.
Windows Subsystem for Linux is only available on 64-bit editions of Windows 105 and can be activated on Windows 10 Anniversary Update and later.
WSL uses fewer resources than a full virtualized machine, the most direct way to run Linux software on a Windows computer, while also allowing users to use Windows apps and Linux tools on the same set of files.5
The OP adds:
So if I install git and it's in /usr/bin/git, does that correspond to a particular folder such as C:\Program Files\etc...?
Yes, under C:\Users\**user**\AppData\Local\lxss\rootfs\usr\..., but you are not supposed to access it directly. You only use it through the WSL bash.
Is setting my PATH different by putting it in my ~/.profile vs. going into Control Panel --> System Properties --> Environment Variables
Yes, completely. If you want to set your Windows Environment Variables PATH, you need to use Git for Windows, as described in here.
The solution assumes u want to access git inside WSL in your Windows Environment
Check this Out
https://github.com/ardevd/gitwrap/releases
This wrapper pipes output from WSL to windows and also works on android studio claimed by the developer
This Wrapper was not developed by me
for any issues plz post on the github page

How do you upgrade your git installation using the windows command prompt?

I recently installed railsinstaller on my computer, but have noticed that the installation for git that came with the application is old. I wanted to install it through the git installer, but it never showed me where I would like for the location of git to be at. My other solution is to upgrade it through the command prompt without using the git installer. How do I do this? Which commands would I have to use in the command prompt terminal?
Installing software from the command prompt isn't an easy task on Windows. First, you will need to find out what technology was used to create the installation package. Then you need to download a (UI based) tool which can modify the installation package to stop asking questions and just do what you want. It's certainly possible ... if you can spend a couple of hours or days to find out how.
Now the reason why the git installer isn't asking is probably because it detects an existing install and wants to upgrade it - since the "new" place must be the old place, no question is asked. To "fix" this, you can try to deinstall Git (Control Panel -> Installed Software -> Remove). When you run the installer again, it should give you more options.
If you just want to update the command line tools, you can also try to unpack the installer or install on a second computer. That should give you the git.exe plus all the DLLs and scripts which you can then copy manually. But Git on Windows also install a MINGW environment with a shell and to update that, you probably have to run the installer so it can make the necessary changes to the registry.

GitHub GUI for Windows: uses old version

I have Windows 8.1 on my laptop and I've installed Git. If I type git --version in Windows' command prompt, the result is git version 1.8.5.2.msysgit.0. I can commit and update all the stuff on the server, everything works fine.
At the same time, I'd like to have a GUI for that so I've installed GitHub for Windows. Unfortunately, it does not let me commit my changes as it report that there is an error as suggests opening a shell (also console-like, but looks different from usual Windows' cmd). If I type in that shell git --version I get git version 1.8.4.msysgit.0 so apparently the GUI app uses an older version of git than the one I need, although I have a needed version of Git installed on my computer.
I appreciate any hints on how to make the GUI app to use the new version of git. If any details are still needed, please tell me - I'll provide them asap. Thanks
You will find the git (embedded in G4W -- GitHub for Windows as SLaks mentions) in
%LOCALAPPDATA%\GitHub\Portable_Git_xxxxx\
(See "Can the credentials stored in Github for Windows be shared with the whole operating system?")
You can try and replace that folder by a portable Git, PortableGit-1.8.5.2-preview20131230.7z: once uncompressed, you can rename the folder with the same name 'Portable_Git_xxxxx' and see if that works.

MSysGit vs. Git for Windows

I am having trouble determining the difference between MSysGit and Git for Windows. How are they different? Why would I choose one over the other?
Are they not the same thing?
On: http://msysgit.github.com/ The title is Git for Windows, the application is msysgit.
Even in the event they are not, I expect the only differences will be in the method of compilation (i.e. compiler used and any options set) and any extraneous packaging (such as having a bash emulating shell as in msysgit). The actual product (Git itself) should remain broadly similar.
Edit: Thanks to Jarrod for pointing this out. I've left the above in for posterity. To quote the wiki:
msysGit is the development environment
to compile Git for Windows. It is
complete, in the sense that you just
need to install msysGit, and then you
can build Git. Without installing any
3rd-party software.
msysGit is not Git for Windows; that
is an installer which installs Git --
and only Git.
It is easy to see the difference: the
installers for Git have the prefix
Git-, the msysGit installers have the
prefix msysGit-. Another telltale is
that the msysGit installers come in
two flavors: fullinstall and
netinstall. Further, msysGit does not
install to C:\Program Files by
default. But msysGit comes with gcc,
the GNU C Compiler.
So, the difference between the two projects:
msysGit is the msys+mingw environment + everything needed to compile Git yourself, on Windows.
Git for Windows is exactly that: Git, compiled for Windows.
(Now) they are the same (as of May 2015 but likely a bit earlier):
"msysgit" and "Git for Windows" have merged under the name "Git for Windows." msysgit.github.io now hosts "Git for Windows" and the main git download site git-scm.com lists msysgit.github.io as the maintained build for windows.
From the updated wiki:
... we decided to just phase out the name "msysGit" (as well as the GitHub org of the same name) and work on Git for Windows (with the corresponding GitHub org, and using the name "Git for Windows" for the installer aimed at "end-users" and "Git for Windows SDK" for the development environment targeting Git for Windows developers).
Here is the excerpt 'Official README'
"portable" version of Git for Windows (MSysGit) does not need tobe installed. It will run from any directory you place it in, evenonto a USB thumbdrive. It will not write permanent entries into the Windows registry. It does not need administrator privileges to "install". This version does not offer you the convenient right-click context menu entries "Git GUI Here" and "Git Bash Here", because these would require to add entries into the Windows registry.
Git for Windows is newer than msysGit. If you want to use Git version 2.x you need to download from https://github.com/git-for-windows/git/releases. https://github.com/msysgit/git/releases is used for Git version 1.x.
Some technical details from https://github.com/git-for-windows/git/wiki/FAQ
Git for Windows used to be developed using the development environment called "msysGit", but roughly coinciding with Git 2.1, msysGit was superseded by a new development environment: the Git for Windows SDK.
As many answers in this post are old.
As on Nov 2015,
msysGit-based Git for Windows 1.x is now superseded by Git for Windows 2.x.
Git for Windows and git-scm both points to same download location for their binary
Download Location:
https://github.com/git-for-windows/git/releases/download/v2.7.1.windows.2/Git-2.7.1.2-64-bit.exe
The titles on the download page have just been updated so that the "Git for Windows" versions are fully identified. There is now both an 'installed' version (with right click menu options), and a Portable version that runs direct from a memory stick etc.
From what I understand Git on Windows is the project consisting of the four bulletpoints below.
Taken directly from https://github.com/msysgit/msysgit/wiki:
Git on Windows
To make the milky 'soup' of project names more clear, we say like this:
msysGit - is the name of this project, a build environment for Git
for Windows, which releases the official binaries
MinGW - is a minimalist development environment for native Microsoft Windows applications.
MSYS - is a Bourne Shell command line interpreter system, is used by MinGW (and others), was forked in the past from Cygwin
Cygwin - a Linux like environment, which was used in the past to build Git for Windows, nowadays has no relation to msysGit
This is a more clear general comparison right from their site https://github.com/msysgit/msysgit
Git for Windows is the software package that installs a minimal environment to run Git on Windows. It comes with a Bash (a Unix-type shell), with a Perl interpreter and with the Git executable and its dependencies.
On the other hand, msysGit is the software package installing the build environment that can build Git for Windows. The easiest way is to install it via the net installer.
Git for Windows is probably what you want. It includes the following primary features:
Git BASH Git for Windows provides a BASH emulation used to run Git
from the command line. *NIX users should feel right at home, as the
BASH emulation behaves just like the "git" command in LINUX and UNIX
environments.
Git GUI As Windows users commonly expect graphical user
interfaces, Git for Windows also provides the Git GUI, a powerful
alternative to Git BASH, offering a graphical version of just about
every Git command line function, as well as comprehensive visual diff
tools.
Shell Integration Simply right-click on a folder in Windows
Explorer to access the BASH or GUI. The Git-Cheetah plugin also
provides a TortoiseSVN-like interface that displays Git functions
directly on the context menu.
The following is available as a separate download from the same page...
msysGit is a build environment that includes all the tools necessary for developers who want to contribute by writing code for Git for Windows.
Git BASH delivers a familiar environment for Linux experts who occasionally need to use a Windows machine -- even if they don't need git itself. It starts with the BASH prompt and adds a collection of core utility programs such as ssh, find, grep, vi, awk, and of course git.

Resources