You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@dscho reached out to me about bundling posh-git with Git for Windows, which I certainly support.
My tentative suggestion would be to have the Git for Windows installer detect a supported PowerShell version (see dahlbyk/posh-git#328 for version support discussion). If available, launch PowerShell to execute a script that runs Install-Module (included in 5.0+, or via PackageManagement PowerShell Modules Preview, if available.
Do you have any way to install it system-wide? (Git for Windows installs system-wide, therefore installing posh-git for the installing user would be a little unfortunate.)
Install-Module accepts a -Scope parameter of either CurrentUser or AllUsers (paths). I assume the Git for Windows installer would be able to spawn an elevated shell to install with AllUsers.
The other part of installation is to inject Import-Module posh-git into a PowerShell profile, which can be one of:
Current User, Current (Default) Host
Current User, All Hosts
All Users, Current (Default) Host
All Users, All Hosts
posh-git's Add-PoshGitToProfile supports -AllHosts but does not support toggling CurrentUser/AllUsers.
Also: what's your release cadence? Would you like to coordinate with Git for Windows releases, or are you fine with me simply picking up the latest posh-git whenever I see a new one?
Release cadence is....infrequent? I'd just let PowerShellGet install the latest for the given platform.
My tentative suggestion would be to have the Git for Windows installer detect a supported PowerShell version (see dahlbyk/posh-git#328 for version support discussion). If available, launch PowerShell to execute a script that runs Install-Module (included in 5.0+, or via PackageManagement PowerShell Modules Preview, if available.
Sounds good!
I assume the Git for Windows installer would be able to spawn an elevated shell to install with AllUsers.
Yes.
posh-git's Add-PoshGitToProfile supports -AllHosts but does not support toggling CurrentUser/AllUsers.
Is that planned?
Release cadence is....infrequent? I'd just let PowerShellGet install the latest for the given platform.
Makes sense. Either the user updates Git for Windows (and gets the posh-git updates via Install-Module), or the user should update posh-git manually.
After running into trouble when e.g. a new Git LFS version came out and users expected a new Git for Windows version to be released just because of that, I think we'll try to learn from that experience a bit and not bundle posh-git.
posh-git has never been part of my job, and interest/availability ebbs and flows. Squeaky wheels get the grease, so I'll probably get a release out this weekend.
If posh-git is the right technical solution for bundling a PowerShell experience with Git for Windows, let's add maintainers and automate releases to remove me as a bottleneck. Or companies that have benefited from it for a decade could sponsor me to spend more time on it. Or I could transfer ownership and walk away.
The other part of installation is to inject Import-Module posh-git into a PowerShell profile, which can be one of:
Current User, Current (Default) Host
Current User, All Hosts
All Users, Current (Default) Host
All Users, All Hosts
posh-git's Add-PoshGitToProfile supports -AllHosts but does not support toggling CurrentUser/AllUsers.
Do you still think it'd be a good idea to bundle posh-git in Git for Windows? It would give it a lot of visibility AKA increased maintenance burden...
I think it would be good for Git for Windows to provide/recommend how to do what Git Bash does (prompt, tab completion) in the default Windows shell.
If posh-git is the best option to achieve that, let's figure out how to make that sustainable. Having this goal to work towards might rekindle my interest.
@dahlbyk so how frequently is posh-git updated (if it really is rarely, I'll gladly reverse my stance)? What is the best way to install it system-wide (I'd like to implement this in InnoSetup, so the ideal for me would be "copy this set of files to that destination, then run this command" or something like that)?
@dahlbyk so how frequently is posh-git updated (if it really is rarely, I'll gladly reverse my stance)?
Updates could theoretically be as frequent as Git adds commands or command flags, if that were a goal. But actual blocking things like the Git LFS version issue are rare, which is why I've not internalized a sense of urgency to ship releases.
What is the best way to install it system-wide (I'd like to implement this in InnoSetup, so the ideal for me would be "copy this set of files to that destination, then run this command" or something like that)?
Three options to consider:
Install-Module -Scope AllUsers posh-git from the online PSGallery. Probably check if it's installed first and update if found?
Install a bundled posh-git into %ProgramFiles%\Git\pwsh\Modules\posh-git\{version} or equivalent, and Install-Module posh-git -Scope AllUsers -Repository $env:ProgramFiles\Git\pwsh\Modules to copy alongside other system modules.
Update the system $PSModulePath to tack on ;%ProgramFiles%\Git\pwsh\Modules instead. If the user has installed or customized posh-git elsewhere that would take precedence on import (I believe).
The other question is if we should run Add-PoshGitToProfile on behalf of the user, and if so which profile - current user or all users? All hosts or just the default? Maybe that's an option they can choose on install? Nothing works without the module being imported.
Could check how Chocolatey handles this for their module.
Okay, once a year-ish is totally doable. The only remaining concern is: are there occasionally vulnerabilities that require coordinated releases?
I don't know that we've ever had an actual vulnerability reported. The vast majority of what we do is just calling git.
My current thinking is that we should make this a new option (probably a new checkbox just like "Check daily for updates"), and use the PSGallery option, i.e. avoid bundling a specific posh-git version.
Pardon my ignorance, though: what commands would I run to check if it is installed, to find out whether there is a newer version, and what commands would be needed to upgrade if there is a new version?
My current thinking is that we should make this a new option (probably a new checkbox just like "Check daily for updates"), and use the PSGallery option, i.e. avoid bundling a specific posh-git version.
I think there are actually two potential settings:
Install system posh-git (and update daily, if selected?)
Include posh-git in profile (which profile?)
2 only makes sense if 1 is selected.
Pardon my ignorance, though: what commands would I run to check if it is installed, to find out whether there is a newer version, and what commands would be needed to upgrade if there is a new version?
@rimrul is correct, though Update-Module is a noop if it's up-to-date so it might not be worth doing a separate find.
Note also that Update-Module will need a -Scope AllUsers just like install.
An edge case we'll need to test is how to behave if the PSGallery isn't marked as trusted. I suppose we could check trust status and reset to untrusted after install if necessary?
In any case, Git for Windows v2.34.0 is expected to land this coming Monday or Tuesday, and it is a little too late in the cycle for me to be comfortable with including a bigger change such as adding the option to install posh-git into the installer.
Agreed.
But right after that version has been released, I am totally in favor of getting this done.
👍 I expect to publish a new posh-git release the week of Nov 22.
Now I have a question: should we uninstall Posh-Git when uninstalling Git for Windows? If so, how do I remove it from the users' profile, programmatically?
Now I have a question: should we uninstall Posh-Git when uninstalling Git for Windows? If so, how do I remove it from the users' profile, programmatically?
Activity
dscho commentedon Dec 7, 2017
Sounds good!
Yes.
Is that planned?
Makes sense. Either the user updates Git for Windows (and gets the posh-git updates via
Install-Module), or the user should update posh-git manually.dahlbyk commentedon Dec 8, 2017
dahlbyk/posh-git#504
I'm a month overdue for a release, so I'll ship that soon.
dscho commentedon Oct 15, 2021
After running into trouble when e.g. a new Git LFS version came out and users expected a new Git for Windows version to be released just because of that, I think we'll try to learn from that experience a bit and not bundle posh-git.
dahlbyk commentedon Oct 15, 2021
Well this is embarrassing. As I said:
posh-git has never been part of my job, and interest/availability ebbs and flows. Squeaky wheels get the grease, so I'll probably get a release out this weekend.
If posh-git is the right technical solution for bundling a PowerShell experience with Git for Windows, let's add maintainers and automate releases to remove me as a bottleneck. Or companies that have benefited from it for a decade could sponsor me to spend more time on it. Or I could transfer ownership and walk away.
An
-AllUsersflag was added in dahlbyk/posh-git#504.dscho commentedon Oct 15, 2021
Do you still think it'd be a good idea to bundle posh-git in Git for Windows? It would give it a lot of visibility AKA increased maintenance burden...
dahlbyk commentedon Oct 16, 2021
I think it would be good for Git for Windows to provide/recommend how to do what Git Bash does (prompt, tab completion) in the default Windows shell.
If posh-git is the best option to achieve that, let's figure out how to make that sustainable. Having this goal to work towards might rekindle my interest.
dscho commentedon Oct 16, 2021
@dahlbyk so how frequently is posh-git updated (if it really is rarely, I'll gladly reverse my stance)? What is the best way to install it system-wide (I'd like to implement this in InnoSetup, so the ideal for me would be "copy this set of files to that destination, then run this command" or something like that)?
rimrul commentedon Oct 16, 2021
Looking at https://github.com/dahlbyk/posh-git/releases, it's roughly once a year (ignoring pre-releases and the occasional two releases on the same day (0.7.0/0.7.1 in april 2017, 0.7.2/0.7.3 in april 2018))
dscho commentedon Oct 16, 2021
Okay, once a year-ish is totally doable. The only remaining concern is: are there occasionally vulnerabilities that require coordinated releases?
dscho commentedon Oct 18, 2021
I guess I should ping @dahlbyk ;-)
dahlbyk commentedon Oct 18, 2021
Updates could theoretically be as frequent as Git adds commands or command flags, if that were a goal. But actual blocking things like the Git LFS version issue are rare, which is why I've not internalized a sense of urgency to ship releases.
Three options to consider:
Install-Module -Scope AllUsers posh-gitfrom the online PSGallery. Probably check if it's installed first and update if found?%ProgramFiles%\Git\pwsh\Modules\posh-git\{version}or equivalent, andInstall-Module posh-git -Scope AllUsers -Repository $env:ProgramFiles\Git\pwsh\Modulesto copy alongside other system modules.$PSModulePathto tack on;%ProgramFiles%\Git\pwsh\Modulesinstead. If the user has installed or customized posh-git elsewhere that would take precedence on import (I believe).The other question is if we should run
Add-PoshGitToProfileon behalf of the user, and if so which profile - current user or all users? All hosts or just the default? Maybe that's an option they can choose on install? Nothing works without the module being imported.Could check how Chocolatey handles this for their module.
I don't know that we've ever had an actual vulnerability reported. The vast majority of what we do is just calling
git.dscho commentedon Oct 19, 2021
@dahlbyk great, thanks!
My current thinking is that we should make this a new option (probably a new checkbox just like "Check daily for updates"), and use the PSGallery option, i.e. avoid bundling a specific
posh-gitversion.Pardon my ignorance, though: what commands would I run to check if it is installed, to find out whether there is a newer version, and what commands would be needed to upgrade if there is a new version?
rimrul commentedon Oct 19, 2021
I assume it's mostly standard Powershell Modules commands, so
Get-InstalledModule -Name posh-gitFind-Module -Name posh-gitshould return the newest available versionUpdate-Module -Name posh-gitdahlbyk commentedon Oct 20, 2021
I think there are actually two potential settings:
2 only makes sense if 1 is selected.
@rimrul is correct, though
Update-Moduleis a noop if it's up-to-date so it might not be worth doing a separate find.Note also that
Update-Modulewill need a-Scope AllUsersjust like install.An edge case we'll need to test is how to behave if the PSGallery isn't marked as trusted. I suppose we could check trust status and reset to untrusted after install if necessary?
7 remaining items
dahlbyk commentedon Nov 11, 2021
Agreed.
👍 I expect to publish a new posh-git release the week of Nov 22.
Let me know what you need from me.
installer: offer to install Posh-Git
dscho commentedon Dec 7, 2021
@dahlbyk I've opened a PR over at git-for-windows/build-extra#401, not sure whether you saw it.
Now I have a question: should we uninstall Posh-Git when uninstalling Git for Windows? If so, how do I remove it from the users' profile, programmatically?
dahlbyk commentedon Dec 9, 2021
🎉 Do you have a target date for 2.35?
Replied over in git-for-windows/build-extra#401 (review).
rimrul commentedon Dec 9, 2021
We aim to have Git for Windows releases out within a few days after the corresponding Git release. According to https://tinyurl.com/gitCal Git 2.35.0 is scheduled to release on January 24th.
installer: offer to install Posh-Git
installer: offer to install Posh-Git
installer: offer to install Posh-Git
dscho commentedon Oct 18, 2024
I think it is time to close this, as experience shows that we won't ever get to it.