I quickly discovered ~\AppData\Local\GitHub containing both the posh-git folder and shell.ps1, the script that sets up the GitHub shell. Especially since GitHub for Windows will happily keep its version up-to-date but you'd have to keep track of your other installation yourself.įaced with this problem, I decided to hunt down how GitHub for Windows installed posh-git to see if I could get it into the rest of my PowerShell consoles. Now, you could install a separate version of posh-git for all your other PowerShell needs, but that seems wrong. Unfortunately, posh-git is only installed for the special version of the console that GitHub for Windows provides and you cannot make that prompt run as administrator, which can be useful once in a while. It even adds a nice console icon to the task bar and Start screen 2. GitHub for Windows includes posh-git for its PowerShell console, if you choose that console when installing or later in the settings. PowerShell console using posh-git GitHub for Windows For those that have not, posh-git adds some git superpowers to your PowerShell console including tab completion for git commands, files and repositories, as well as an enhanced command prompt that tells you the current branch and its state 1. # Example Contents for install-git-instructions.If you use git for version control and you use Microsoft Windows, you may well have used posh-git, a module for PowerShell. Start-Process c:\Git-2.39.0-64-bit.exe -ArgumentList '/LOADINF=""C:\install-git-instructions.txt"" /SILENT' -Wait \ # Assuming that you have "install-git-instructions.txt" file in the directory where this Dockerfile is located Which will then include the path to git.exe in the Path variable.įROM /windows/servercore:ltsc2019 Alternatively, you could update the current powershell Path environment variable with $env:Path = ::GetEnvironmentVariable("Path","Machine") + " " + ::GetEnvironmentVariable("Path","User") Running this will require a restart of the shell in order to update the Path environment variable and have git commands work. Learned about the install parameter file from this answer to a similar question. As an example, this is the one I'm using (which I obtained by running through the git installer exe once with the /SAVEINF= parameter): Ĭomponents=ext,ext\shellhere,ext\guihere,gitlfs,assoc,autoupdate Where is the path to a file that contains install parameters for the git installation. Start-Process -FilePath $installer -ArgumentList $install_args -Wait $install_args = "/SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /LOADINF=""$git_install_inf""" Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $installer $asset = Invoke-RestMethod -Method Get -Uri $git_url | % assets | where name -like "*64-bit.exe" The following is working for me, using powershell to download and install the 64-bit version of git-for-windows: # get latest download url for git-for-windows 64-bit exe Was looking to do the same without using chocolatey.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |