liveBook · Manning

Git clone

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

git clone is a Git command that creates a local repository by copying an existing repository and its history.

git clone creates a local repository by copying an existing GitHub repository and its history. Run it from the parent directory where the new repository should live. section 19.5

Use this practical sequence:

  • Create or select a repository on GitHub, then copy its clone link. section 19.5
  • In PowerShell, change to the intended parent directory and run git clone with the repository URL. section 19.5
  • Change into the new directory and inspect the copied files. section 19.5

Clone a SharePoint tools repository

PS C:\scripts> git clone https://github.com/psjamesp/sharepointtools.git PS C:\scripts> cd .\sharepointtools\ PS C:\scripts\sharepointtools> dir The resulting directory contains LICENSE and README.md. section 19.5

PS C:\scripts> git clone https://github.com/psjamesp/sharepointtools.git
Cloning into 'sharepointtools'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.

View the clone operation and its transfer progress. section 19.5

PS C:\scripts> cd .\sharepointtools\
PS C:\scripts\sharepointtools> dir
    Directory: C:\scripts\sharepointtools
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/19/2023   2:59 PM           1088 LICENSE
-a----        6/19/2023   2:59 PM             44 README.md

View the files present after cloning. section 19.5

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Shows the command, parent-directory setup, clone output, and resulting files, but not clone options or troubleshooting.
Examples
Uses a SharePoint tools repository cloned under C:\scripts, followed by navigation and directory inspection.
What it assumes
Assumes GitHub and PowerShell basics while demonstrating location selection and command execution.
What you can do after
Apply it via Git to create and inspect a local copy of a GitHub repository.
How it connects
Connects GitHub, local repositories, remote repositories, and Git history.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.