0

I have a local clone of the PowerShellForGitHub project.

I can get the project URL using the command:

PS C:\src\PowerShellForGitHub> git remote get-url origin
https://github.com/microsoft/PowerShellForGitHub.git

There is a file in the project named GitHubUsers.ps1

PS C:\src\PowerShellForGitHub> Get-ChildItem -File .\GitHubUsers.ps1

    Directory: C:\src\PowerShellForGitHub

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          2022-09-23    08:37          14690 GitHubUsers.ps1

The URL for this file on the GitHub site is:

https://github.com/microsoft/PowerShellForGitHub/blob/master/GitHubUsers.ps1

How can I get this file URL from the command line in my local repo?

lit
  • 14,456
  • 10
  • 65
  • 119
  • 1
    Any command to do that would have to be specific to GitHub - there is no requirement in git for each file to have such a URL, or what it should look like. You could have a look at [the GitHub CLI tool](https://cli.github.com/manual/), but I can't see anything promising at a glance. Or you could just write your own, with the parts you already have and some simple string replacement. – IMSoP May 03 '23 at 14:52

0 Answers0