
close
close
Apart from the amusing name, POSH-GIT is a PowerShell module for GitHub supplied as part of Git for Windows. In this Ask the Admin, I’ll show you how to use Git source control via this PowerShell module.
If you’ve been following my series on GitHub, you’ll understand the basics of Git, GitHub and how to work with GitHub for Windows, the free GUI tool. Git is an open-source versioning system for code, which when used with a hub – think GitHub – allows developers to collaborate on projects in the cloud. When GitHub for Windows is installed, the PowerShell module for GitHub, Git Shell, is also installed, allowing you to clone repositories, send pull requests, among other things, all from the command line.
For more information on Git and GitHub, see What is GitHub?, Create a GitHub Repository, and GitHub for Windows – Installation, Adding Accounts, Committing Changes, and Syncing Repos on the Petri IT Knowledgebase.
Make sure that GitHub for Windows is installed, and open the Git Shell by double clicking the Git Shell icon on your desktop. You can alternatively use Import-Module Posh-Git to import the module, but you’ll need to change the working directory, or specify the full path to the posh-git.psm1 PowerShell module file, to the GitHub for Windows LocalAppData directory.
To clone a repo from GitHub, you first need the download URI.
git clone git://github.com/dahlbyk/posh-git.git
Clone a GitHub repository using POSH-GIT (Image Credit: Russell Smith)
Some repos can only be cloned using a secure connection. To add that ability to Git Shell, you’ll need to generate an SSH key as follows:
Create an SSH key (Image Credit: Russell Smith)
Let’s create a new repo on the local PC with no connection to GitHub.
Let’s commit changes we’ve made to a repo.
Add and commit files using POSH-GIT (Image Credit: Russell Smith)
Once the files have been committed, we can push the repo to GitHub.
git request-pull v1.0 https://github.com/user/petri_testing.git
Push committed changes (Image Credit: Russell Smith)
Related Article:
More in Windows Server
New Memory Integrity Scan Tool Lets Users Check for Compatibility Issues on Windows PCs
May 11, 2023 | Rabia Noureen
Microsoft Releases Updates to Fix Secure Boot Flaw on Windows 10/11 and Windows Server
May 10, 2023 | Rabia Noureen
Microsoft Confirms Interoperability Issues Between New Windows LAPS and Legacy LAPS Policies
Apr 14, 2023 | Rabia Noureen
Windows LAPS is Now Natively Integrated on Windows 11, Windows 10, and Windows Server
Apr 12, 2023 | Laurent Giret
Most popular on petri