liveBook · Manning

GitHub

As explained in Practical Automation with PowerShell: Effective scripting from the console to the cloud

GitHub is a web platform for hosting, collaborating on, and distributing software source code through version-controlled repositories.

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

How Practical Automation with PowerShell: Effective scripting from the console to the cloud covers it

How deep it goes
Walks through repository initialization, staging, committing, remote creation, and pushing rather than Git internals.
Examples
Demonstrates publishing and synchronizing a private PoshAutomator module containing Get-SystemInfo.
What it assumes
Requires a GitHub account, Git command-line tools, GitHub CLI, and an existing module folder.
What you can do after
Operate/configure a private GitHub repository by committing a local PowerShell module and pushing its main branch.
How it connects
Connects GitHub repositories with Git, PowerShell modules, GitHub Gist, Azure DevOps, Bitbucket, and PowerShell Gallery.

Also explained in

Compare how 8 books explain GitHub →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Practical Automation with PowerShell: Effective scripting from the console to the cloud. The section links point to the parts of the book it draws on.