> For the complete documentation index, see [llms.txt](https://www.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.osdeploy.com/archive/pscloudscript/github-git-repo.md).

# GitHub Git Repo

Another way to save a PowerShell script online is to save it in a GitHub Git Repo. In this example, I have created a GitHub Repo at this link

{% embed url="<https://github.com/OSDeploy/PSCloudScript>" %}

In this Repo, I have a script called Test-PSCloudScriptGit.ps1. The link below is not the Raw link, so I'll need to get that

{% embed url="<https://github.com/OSDeploy/PSCloudScript/blob/main/Test-PSCloudScriptGit.ps1>" %}

## Get the Raw URL

For a file in a GitHub Repo, pressing the Raw button will open a new webpage that contains the Raw URL that you can link to

![](https://3996045416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDKRxGiKLYjW1gana2O%2Fuploads%2FL5Pz1UlKadegaABkdgu8%2Fimage.png?alt=media\&token=b8e96c8b-e2ba-4ff8-8683-c3ed45cb4363)

![](https://3996045416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDKRxGiKLYjW1gana2O%2Fuploads%2FeEruTsSKhJ7lVUQm4axL%2Fimage.png?alt=media\&token=877f5110-79b4-49ce-89aa-91dc680d0fdf)

If you have the OSD PowerShell Module 22.1.15+ then you can use the `Get-GithubRawUrl` function to resolve the proper Raw URL for you

```powershell
PS C:\> Get-GithubRawUrl https://github.com/OSDeploy/PSCloudScript/blob/main/Test-PSCloudScriptGit.ps1
https://raw.githubusercontent.com/OSDeploy/PSCloudScript/main/Test-PSCloudScriptGit.ps1
```

## Execution

Execution is simple. Perform an Invoke-RestMethod on the Raw URL and then perform an Invoke-Expression on the Raw URL content. The example below shows a few different ways you can do this and tests the function that was contained in the Script

![](https://3996045416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDKRxGiKLYjW1gana2O%2Fuploads%2FRzGgbhzksrJfOMVVOldw%2Fimage.png?alt=media\&token=f73aa348-ac74-49e0-85ef-4afe9e05ed2d)

## Sponsor

OSDeploy is sponsored by [Recast Software](https://www.recastsoftware.com/?utm_source=osdeploy\&utm_medium=ad\&utm_campaign=web) and their Systems Management Tools

{% embed url="<https://www.recastsoftware.com/?utm_source=osdeploy&utm_medium=ad&utm_campaign=web>" %}
Sponsored by Recast Software
{% endembed %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.osdeploy.com/archive/pscloudscript/github-git-repo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
