A collection of PowerShell scripts for automatically cloning repositories from Azure DevOps and GitHub organizations.
These scripts help developers maintain local copies of all repositories they have access to across different Git hosting platforms. They automatically discover, clone, and keep repositories up to date with a clean, organized directory structure.
- Purpose: Clones all repositories from all projects in an Azure DevOps organization
- Authentication: Uses Azure CLI (no manual token management)
- Features: Multi-project support, automatic organization, smart updates
- Documentation: README-AzureDevOps-Clone.md
- Purpose: Clones all GitHub repositories you have access to (personal, organization, collaborator)
- Authentication: Uses GitHub Personal Access Token
- Features: Multi-source support, private repo handling, organization discovery
- Documentation: README-GitHub-Clone.md
- Install and authenticate Azure CLI:
az login - Configure
CloneAllRepos.config - Run:
powershell -ExecutionPolicy Bypass -File clone.ps1
- Create a GitHub Personal Access Token
- Configure
CloneGitHubRepos.config - Run:
powershell -ExecutionPolicy Bypass -File clone-github.ps1
After running both scripts, you'll have:
C:\Git\
├── YourOrganization\ # Azure DevOps repos
│ ├── Project1\
│ │ ├── Repo1\
│ │ └── Repo2\
│ └── Project2\
│ └── Repo3\
└── GitHub\ # GitHub repos
└── YourUsername\
├── PersonalRepo1\
├── PersonalRepo2\
└── OrganizationRepo1\
- PowerShell: Windows PowerShell or PowerShell Core
- Git: Must be installed and configured
- Azure CLI: For Azure DevOps script (install via
winget install Microsoft.AzureCLI) - GitHub Personal Access Token: For GitHub script
[General]
Url=https://dev.azure.com/YourOrganization/project
[LocalGitConfig]
GitPath=C:\Git\
OrgName=YourOrganization
[GitOptions]
PruneLocalBranches=false
GitEmail[email protected][GitHub]
GitHubUsername=your-github-username
GitHubToken=your-github-personal-access-token
[LocalGitConfig]
GitPath=C:\Git\
[GitOptions]
PruneLocalBranches=false
GitEmail[email protected]| Feature | Azure DevOps | GitHub |
|---|---|---|
| Multi-project/org support | ✅ | ✅ |
| Private repository support | ✅ | ✅ |
| Automatic directory organization | ✅ | ✅ |
| Smart updates (clone/pull) | ✅ | ✅ |
| Branch pruning | ✅ | ✅ |
| Pagination support | ✅ | ✅ |
| Error handling | ✅ | ✅ |
| Progress tracking | ✅ | ✅ |
| Authentication method | Azure CLI | Personal Access Token |
- Development Teams: Keep all organization repositories locally available
- Consultants: Maintain access to multiple client repositories
- Open Source Contributors: Track repositories across different organizations
- Backup Strategy: Local copies of all accessible repositories
- Offline Development: Work with repositories when internet is limited
- Uses Azure CLI authentication (secure, no stored tokens)
- Repository URLs logged to console
- No credentials stored in plain text
- Personal Access Token stored in config file
- Token should have minimal required scopes
- Consider token expiration and rotation
- Repository URLs logged to console
- Authentication errors: Check Azure CLI login or GitHub token
- Permission denied: Verify access to organizations/projects
- Directory creation failed: Check file system permissions
- Rate limiting: Wait and retry (GitHub)
- Check the individual script documentation for detailed troubleshooting
- Verify prerequisites are met
- Ensure configuration files are properly formatted
- Check network connectivity and firewall settings
Feel free to enhance these scripts with:
- Additional Git providers (GitLab, Bitbucket, etc.)
- Repository filtering options
- Parallel cloning for performance
- Custom branch management
- Integration with CI/CD systems
These scripts are provided as-is for educational and development purposes.
For issues or questions:
- Check the individual script documentation
- Verify your configuration
- Test with a small subset of repositories first
- Review the troubleshooting sections