gh-copilot icon indicating copy to clipboard operation
gh-copilot copied to clipboard

[BUG]: Could not find file gh-copilot.ps1

Open fredgohsman opened this issue 1 year ago • 0 comments

What happened?

Installed the github/gh-copilot extension on Windows in Terminal (PowerShell). gh copilot extension and suggest commands work fine When I run the commands to enable aliases, it is unable to find the gh-copilot.ps1 file.

Alias PowerShell commands:

$GH_COPILOT_PROFILE = Join-Path -Path $(Split-Path -Path $PROFILE -Parent) -ChildPath "gh-copilot.ps1"
gh copilot alias -- pwsh | Out-File ( New-Item -Path $GH_COPILOT_PROFILE -Force )
echo ". `"$GH_COPILOT_PROFILE`"" >> $PROFILE

Versions

gh version 2.49.0 (2024-04-30) gh copilot version 1.0.2 (2024-04-26)

Relevant terminal output

New-Item : Could not find file 'C:\Users\...\OneDrive\Documents\WindowsPowerShell\gh-copilot.ps1'.
At line:1 char:39
+ ... lias -- pwsh | Out-File ( New-Item -Path $GH_COPILOT_PROFILE -Force )
+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\...\O...\gh-copilot.ps1:String) [New-Item], FileNotFoundException
    + FullyQualifiedErrorId : NewItemIOError,Microsoft.PowerShell.Commands.NewItemCommand

Out-File : Cannot bind argument to parameter 'FilePath' because it is null.
At line:1 char:37
+ ... lias -- pwsh | Out-File ( New-Item -Path $GH_COPILOT_PROFILE -Force )
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Out-File], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.OutFileComm
   and

fredgohsman avatar May 03 '24 14:05 fredgohsman