17

I am trying to install Git on Windows 10, but without Git Bash or GUI. I want to use Git in PowerShell and I would like not to bloat my PC. I know the install size is small, but that's not the issue.

I've tried going through the installer from git-SMC/Git for Windows a couple times, but it appears I can not opt out of GUI and Bash. Any idea how I can do this? Perhaps Chocolatey is of any use?

Thanks in advance!

  • Even the minimal versions require some components, such as a shell, because Git requires a minimal POSIX environment to invoke hooks and such. – bk2204 Jun 02 '20 at 22:56

4 Answers4

16

You can use MinGit

MinGit is provided on the Git for Windows repository

https://github.com/git-for-windows/git/releases

It does not come preinstalled with Git Bash, GitK or Vi etc.

pratikpc
  • 432
  • 4
  • 12
  • 1
    MinGit is 100% what I am looking for. Been looking for a way to install via chocolatey, but I'm not seeing anything. I only see git and git (portable) but no minimum. Too bad. – electr0sheep Dec 07 '20 at 23:34
  • Scoop supports MinGit if that works for you @electr0sheep – pratikpc Dec 09 '20 at 11:30
  • I installed git on a new Windows PC. I had seen a Windows git installation contains nearly a whole Linux OS, before, so I tried to choose the minimum options in the installer, like choosing "notepad" as the default editor. Still, it installed the same things, including VIM, nano etc. Does git really need all those Linux stuff to work on Windows? The mingw64 + usr folders take 700MB. – Damn Vegetables Jan 12 '21 at 14:58
  • @DamnVegetables mingit does not install nano though. I do not know why Git installs all those tools by default. Possibly to make _*NIX users feel right at home_ according to their website. I use Scoop so I do not need Vim or Nano installed via Git to be honest so I prefer MinGIT. – pratikpc Jan 13 '21 at 03:50
1

The github repo publishes portable and minimum versions of the binary releases which don't require installation. You could prune out the parts you don't want if you need to cut it down further.

https://github.com/git-for-windows/git/releases

Or instalation Using Chocolatey, if that will be ok for you

https://www.jamessturtevant.com/posts/5-Ways-to-install-git-on-Windows/#using-chocolatey

Nick
  • 461
  • 2
  • 10
  • 1
    I tried through Chocolatey with the link you provided. It suggests ```choco install git -params '"/GitAndUnixToolsOnPath"'``` This however still installs Git Bash and GUI. Any Idea what I could do differently? I see here that I could add parameters, but I'm very unfamiliar with this https://chocolatey.org/packages/git – Laurens Hoogenboom Jun 02 '20 at 14:28
  • I thing you need this param: **/NoShellIntegration** - Disables open GUI and open shell integration ( "Git GUI Here" and "Git Bash Here" entries in context menus). – Nick Jun 02 '20 at 14:37
  • 1
    /NoShellIntegration will not do what OP is asking for https://chocolatey.org/packages/git#description – electr0sheep Dec 07 '20 at 23:36
0

I started with Git and then removed everything except the following dirs:

  • \mingw64\libexec\git-core
  • \ssl

Rename git-core to cmd and move it up 2 levels and you don't even have to edit your .gitconfig.

Works like a charm for me.

dwo
  • 3,576
  • 2
  • 22
  • 39
  • [Here](https://github.com/git-for-windows/git/wiki/MinGit#what-is-included-in-or-excluded-from-mingit) the maintainers say they try to _"keep the size as small as possible without breaking non-interactive Git usage."_ MinGit is 55mb. The aforementioned two folders are less than 5mb combined. Kinda doesn't add up.. How did you arrive at that combination? – gargoylebident Apr 24 '22 at 09:06
  • These two folders (including subfolders) are 55 MB on my machine. – dwo Apr 25 '22 at 08:07
  • I don't think you did what you say you did then, so I suggest you remove your answer. I've tested your instructions on a fresh MinGit download, which is 55MB (you're free to check for yourself), and they shrink it down to <5MB and more or less render git useless. – gargoylebident Apr 26 '22 at 02:57
  • Don't tell me what I did or didn't! The git-core folder contains 236 files netting up to 55.3 MB. – dwo Apr 27 '22 at 09:50
  • Now I found the difference you mean. Edited the answer. – dwo Apr 27 '22 at 10:08
  • 2
    So you ended up with Mingit. As I said, I suggest you remove the answer. It's at best redundant. I also wasn't telling you what you did or didn't do, read my comment again please. – gargoylebident Apr 28 '22 at 07:55
0

Those who are still looking for a silent installation use /VERYSILENT parameter during installation through git installer.

Use below Powershell script, its basically downloading the latest version from git release and installing silently with no UI. make sure to replace the latest release url at $git_latest_executable_download_url

$git_latest_executable_download_url= "https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/Git-2.41.0-64-bit.exe"
$git_latest_executable= "$pwd\Git-64-bit.exe"

Write-Host "Downloading latest Git intaller..."
(New-Object System.Net.WebClient).DownloadFile($git_latest_executable_download_url, $git_latest_executable)
.\Git-64-bit.exe /VERYSILENT /NORESTART
Write-Host "Latest Git version been installed."
Rezoan
  • 1,745
  • 22
  • 51