git clone downloads a complete copy of a remote repository, including the full commit history, branches and tags. From the Cerewro chat you can clone any repository from GitHub, GitLab, Bitbucket or Azure DevOps without opening a terminal.
Clone the repository https://github.com/user/my-project into the folder C:\projects
git clone https://github.com/user/my-project C:\projects\my-project
| Variant | Command | When to use |
|---|---|---|
| Full clone | git clone URL | First download of the repo |
| Specific branch | git clone -b develop URL | Only want one branch |
| Shallow clone | git clone --depth 1 URL | Large repos, last commit only |
| With submodules | git clone --recurse-submodules URL | Projects with Git submodules |
| Via SSH | git clone git@github.com:user/repo.git | Authentication with SSH key |
git clone https://YOUR_TOKEN@github.com/user/private-repo.git
# Save credentials in Windows Credential Manager
git config --global credential.helper manager-core
# From now on git will ask for username/token once and save them
git clone https://github.com/user/private-repo.git
Read the repos.txt file with the list of repositories and clone them all into C:\projects
$repos = Get-Content "repos.txt"
foreach ($repo in $repos) {
$name = Split-Path $repo -Leaf
$name = $name -replace '\.git$', ''
Write-Host "Cloning: $name..."
git clone $repo "C:\projects\$name"
if ($LASTEXITCODE -eq 0) {
Write-Host "OK: $name" -ForegroundColor Green
} else {
Write-Warning "ERROR: $name"
}
}
--depth 1 to reduce clone time for repositories with a long history (years of commits).