GitHub stores Git repositories: shared codebases whose history records snapshots of files over time. For a team maintaining PowerShell automation, a repository provides a durable place to publish a module, collaborate on it, and keep remote workers from relying on a LAN-only share or emailed copies. section 12.1 section 12.2
Choose a repository when an automation has become reusable team tooling rather than a one-off script. A private repository can limit access to invited contributors, while a public repository can be broadly visible. GitHub’s Git foundation also makes the workflow transferable to Git-based platforms such as Azure DevOps and Bitbucket. section 12.1 section 12.2.1
A practical repository workflow separates local version-control work from remote hosting:
- Initialize Git in the module folder. This creates the hidden .git directory that holds repository configuration. section 12.2.1
- Stage files explicitly with git add. Files merely present in the folder are not automatically part of the repository. section 12.2.1
- Commit a snapshot with a meaningful message, preserving a point from which file changes can be reviewed over time. section 12.2.1
- Name the default local branch main, create the GitHub remote, connect it, and push the branch to synchronize local files. section 12.2.1
Publishing a private PoshAutomator module
After testing a PoshAutomator module containing Get-SystemInfo, initialize the module directory, stage its manifest, module files, installation script, and public function, then commit and push them to a private GitHub repository. The remote repository becomes the shared source for company-specific code without placing it in the public PowerShell Gallery. section 12.2 section 12.2.1
For one small script, GitHub Gist avoids creating a full repository. A gist is a shareable code snippet with built-in version control, public or private visibility, browser syntax highlighting, comments, and local PowerShell execution. Use a repository when the work needs a structured, evolving module; use a gist when rapid single-script sharing is enough. section 12.1
git config --global user.email "you@example.com" git config --global user.name "Your Name" gh auth login –-web
Configure the Git identity displayed with commits, then authenticate the GitHub CLI in a browser before creating or synchronizing repositories. section 12.0
git push -u origin main Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Compressing objects: 100% (6/6), done. Writing objects: 100% (7/7), 3.56 KiB | 3.56 MiB/s, done. Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/mdowst/PoshAutomator.git * [new branch] main -> main Branch 'main' set up to track remote branch 'main' from 'origin'.
Push the local main branch to the connected remote and establish upstream tracking so the initial module files are synchronized with GitHub. section 12.2.1







