This tool is designed to help you automatically clone or pull all repositories from your GitHub account. It's especially handy if you switch between multiple machines and want to keep your codebase up-to-date on all of them.
- Clone the repository:
git clone https://github.com/PapaPeskwo/repo-sync
- Install the required packages:
pip install -r requirements.txt
- Set up the .env file:
Copy the sample configuration from .env.example (if you have one) or create a new .env file in the root directory with the following structure:
GITHUB_USERNAME=YOUR_GITHUB_USERNAME
GITHUB_TOKEN=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN
BASE_DIR=/path/to/your/projects/directory
SKIP_REPOS=RepoNameToSkip1,RepoNameToSkip2
When generating a Personal Access Token (PAT) from GitHub for this tool, ensure it has the following permissions:
- repo: This grants full control of private repositories, which includes:
- repo:status - Access commit status.
- repo_deployment - Access deployment status.
- public_repo - Access public repositories.
- repo:invite - Access repository invitations.
- security_events - Read security vulnerability alerts.
- read:user: Grants access to read a user’s profile data.
To create a token:
- Navigate to your GitHub settings.
- Under "Developer settings", click on "Personal access tokens".
- Click "Generate new token".
- Provide a descriptive name for the token.
- Select the required permissions.
- Generate the token and save it securely. Once you navigate away, you won't be able to see the token again.
Once you've set up the .env file and installed the requirements:
python repo_sync.py
This will either clone new repositories or pull the latest changes for existing repositories from your GitHub account, based on the configurations in the .env file. Security
Contributions are welcome! Please create an issue or open a pull request with your changes.