This Python script automates the process of cloning repositories from GitHub. It can clone all repositories starred by a user or all repositories from a specific organization.
- Clone all starred repositories for a user.
- Clone all repositories from a GitHub organization.
- Command-line interface to specify what to clone.
- Handles GitHub API pagination to fetch all repositories.
- Includes rate limiting handling to avoid API request failures.
- Skips already cloned repositories to avoid duplication.
- Python 3.x
requestslibraryGitPythonlibrary- A GitHub Personal Access Token (PAT)
git clone https://github.com/manupawickramasinghe/clone-github-starred.git
cd clone-github-starredpip install -r requirements.txtExecute the script using the command-line interface. You must provide a GitHub Personal Access Token (PAT) with the --token argument.
Use the --starred argument with your GitHub username.
python github_clone.py --token YOUR_PAT --starred YOUR_USERNAMEUse the --org argument with the organization name.
python github_clone.py --token YOUR_PAT --org ORGANIZATION_NAME--clone-dir: Specify a directory to clone the repositories into. Defaults torepos.python github_clone.py --token YOUR_PAT --starred YOUR_USERNAME --clone-dir my_starred_repos
- Ensure your PAT has the necessary permissions to read repository data.
- Verify your network connection if cloning fails.
- If repositories already exist, the script will skip them.
Feel free to submit issues or pull requests to enhance the functionality.
This project is licensed under the MIT License.