I've been trying to get git-secrets installed for the last couple of hours, and can not seem to figure it out. Google searching gets me almost nothing, almost all of the results are for git-secret (singular secret, not plural).
I cloned the folder to my computer and opened WindowsPower Shell in Administrator mode to run the install.ps1 file.
This is the output that I got from PowerShell:
Checking to see if installation directory already exists...
Creating installation directory.
Copying files.
Copy-Item : Cannot find path 'C:\windows\system32\git-secrets' because it does not exist.
At C:\Users\ricci\Downloads\git-secrets\install.ps1:15 char:1
+ Copy-Item ./git-secrets -Destination $InstallationDirectory -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\windows\system32\git-secrets:String) [Copy-Item], ItemNotF
oundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
Copy-Item : Cannot find path 'C:\windows\system32\git-secrets.1' because it does not exist.
At C:\Users\ricci\Downloads\git-secrets\install.ps1:16 char:1
+ Copy-Item ./git-secrets.1 -Destination $InstallationDirectory -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\windows\system32\git-secrets.1:String) [Copy-Item], ItemNo
tFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
Checking if directory already exists in Path...
Already in Path.
Adding to user session.
Done.
When I run git secrets --register-aws --global in a repo directory it returns git: 'secrets' is not a git command. See 'git --help'
Any idea what I need to do or where I can look for help?
Thanks
install.ps1 includes:
Param([string]$InstallationDirectory = $($Env:USERPROFILE + "\.git-secrets"))
It appears $Env:USERPROFILE is, in your session, C:\Windows\System32, which is not good.
Try and open a Powershell session:
as your own Windows account (not admin)
within your %USERPROFILE% Path (C:\Users\xxx) instead of C:\Windows\System32
Related
Any help is appreciated.
I am getting the error below when trying to execute the PowerShell script in Runbooks.
Invoke-ASCmd : The term 'Invoke-ASCmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:27 char:1 + Invoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $Dat ... + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Invoke-ASCmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
But when I execute the same script locally then it is successful.
Powershell executed locally
I tried to install the SqlServer module using the script:
Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
but it gave me the errors below.
Error 1:
Exception calling "ShouldContinue" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Client\AppData\Roaming\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?" At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7455 char:8 + if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : HostException
Error 2:
Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed. At line:12 char:1 + Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUs ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Install-Module], InvalidOperationException + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module
So, I tried to install the NuGet package using the script:
Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
but it gave me the error below:
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags. At line:11 char:1 + Install-PackageProvider -Name NuGet -Scope CurrentUser -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
I tried installing the following scripts in succession hoping to resolve the issue:
PowerShell Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
PowerShellInstall-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
PowerShellInvoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $DatasetName
Error running the PowerShell script in Runbooks:
Reasons for error:
Need to check:
The term 'Invoke-ASCmd' is not recognized as the name of a cmdlet:
Add/import the required module by opening below path:
Azure Automation account -> Shared Resources -> Modules -> Add a module Search for sql server from PS Gallery and import.
If you are installing module with script, it is not installing properly sometimes. I suggest you add modules and then invoke Invoke-ASCmd command in runbook.
I tried to install SQL Server after importing, but it failed since "Administrator rights" were required.
To resolve this, You can run account as an administrator or assign managed identities.
I used the following command to assign a
'UserAssigned Managed Identity' to the Automation account:
set-azautomationaccount -Resourcegroupname "Jahnavi" -Name "Jahnaviauto" -AssignUserIdentity "/subscriptions/<SubscriptionID>/resourceGroups/Jahnavi/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<UserIdentityName_user>"
Now, I installed using below command and it worked for me successfully:
Install-Module -Name SqlServer -AllowPrerelease -Force -Verbose -Scope CurrentUser
Exception calling "ShouldContinue" with "2" argument(s):
This error can occurs when you have a package installed in the list and attempt to override it with the required version again.
Use Moduleversionoverrides parameter in these cases.
I'm trying to run a windows vm in virtualbox and use it as a runner in git lab, following https://docs.gitlab.com/runner/executors/virtualbox.html#use-native-openssh-and-powershell
I installed native open ssh, git for windows and configured the default shell to be pwsh as they request:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$PSHOME\pwsh.exe" -PropertyType String -Force
however SSH does not work. When I try to ssh to localhost:
ssh MACHINE_NAME\username#localhost
I get Permission denied, try again
when I do this. If I do
reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
then I can ssh into my machine. THe gitlab can also, but then it complains that bash is not a command on power shell:
00:02
bash : The term 'bash' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ bash -l
+ ~~~~
+ CategoryInfo : ObjectNotFound: (bash:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
ERROR: Job failed: prepare environment: Process exited with status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
To fix that, I installed WSL and ubuntu on Windows, but then it gives
ERROR: Job failed: prepare environment: Process exited with status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
this is a known problem in ubuntu which is fixed by removing .bash_logout but I can't do this to the WSL image. Also, installing WSL shouldn't be the way here, it should work without WSL.
I have tried installing the Azure and AZ cmdlet via the command with AllowClobber and that successfully installed. I am running PowerShell as administrator and have connected my Azure account by signing in. However, when running the command "Get-AzurePublishSettingFile" the following error appears:
Get-AzurePublishSettingFile : The term 'Get-AzurePublishSettingFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
Get-AzurePublishSettingFile
+ CategoryInfo : ObjectNotFound: (Get-AzurePublishSettingFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Make sure you have installed the ASM PowerShell module Azure, and I notice you missed an s in your command, it should be Get-AzurePublishSettingsFile, not Get-AzurePublishSettingFile.
Reference - https://learn.microsoft.com/en-us/powershell/module/servicemanagement/azure.service/get-azurepublishsettingsfile?view=azuresmps-4.0.0
I am trying to run Contoso Monetization Code Sample Web App provided by Microsoft as a starting point for moving from paid add-in to SaaS offering. I am stuck at the very end where I am meant to be updating the Azure Active Directory Applications. I get this error
Get-MgApplication : The term 'Get-MgApplication' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
+ $webApp = Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq ...+ CategoryInfo : ObjectNotFound: (Get-MgApplication:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Here is the code referencing the 'Get-MgApplication'.
$webApp = Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $webAppDisplayName}
$webAppSiteName = $armConfigJson.parameters.webAppSiteName.value
$redirectUris = "https://$webAppSiteName.azurewebsites.net/signin-oidc","https://$webAppSiteName.azurewebsites.net/"
Update-MgApplication -ApplicationId $webApp.Id -WebRedirectUris $redirectUris
I have checked online without any success to find if this module can be imported and loaded. I have also checked using the command get-Module to check if is in the power shell module folder and probable misspelled but it not there as well. Any help will be much appreciated.
You need to install the Microsoft.Graph.Beta cmdlets - https://github.com/microsoftgraph/msgraph-sdk-powershell/tree/master
I tried to get Azure Stack identity health report according to the below document. But getting error if the packages are installed on power shell.
Link
Get-AzsHealthReport : The term 'Get-AzsHealthReport' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:3 char:17
+ $healthReport = Get-AzsHealthReport -AdminResourceManagerEndpoint $Ad ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzsHealthReport:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Follow the steps provided in this document on powershell as Admin.
Start Powershell in Admin mode and run the below steps:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Install the AzureRM.BootStrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRM.BootStrapper
# Install and import the API Version Profile required by Azure Stack into the current PowerShell session.
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.7.2
Now install Azure Stack Tools:
https://github.com/Azure/AzureStack-Tools/tree/master/Identity#download-azure-stack-tools
cd C:
mkdir Azure-Stack
cd .\Azure-Stack\
# Download the tools archive.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
invoke-webrequest `...
# Expand the downloaded files.
expand-archive master.zip `...
# Change to the tools directory.
cd AzureStack-Tools-master
cd .\Identity\
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Import-Module ..\Connect\AzureStack.Connect.psm1
Import-Module ..\Identity\AzureStack.Identity.psm1
Get-AzsHealthReport
You should now be able to run the command.
Hope this helps!