| .. | ||
| check_repo_access.sh | ||
| list_user_repos.sh | ||
| README.md | ||
GitHub Access Scripts
This directory contains scripts to check user access to GitHub repositories.
Setup
-
Create
accounts.json: Before running the scripts, you need to create anaccounts.jsonfile in the root of this project. This file should contain an array of GitHub accounts, each with a username and a personal access token (PAT).Example
accounts.json:[ { "user": "your_github_username", "token": "your_personal_access_token" }, { "user": "another_github_username", "token": "another_personal_access_token" } ] -
Permissions: The personal access tokens require the
reposcope to read repository information and collaborator lists.
Security Warning: Storing personal access tokens in a plaintext file is a security risk. If this file is ever exposed, your accounts could be compromised. For better security, consider using environment variables or a dedicated secrets management tool to handle these credentials.
Usage
Make sure the scripts are executable before running them:
chmod +x github_access_scripts/check_repo_access.sh
chmod +x github_access_scripts/list_user_repos.sh
check_repo_access.sh
This script checks if a specific user has collaborator access to a single, specified repository.
Command:
./github_access_scripts/check_repo_access.sh <GITHUB_USER_NAME> <REPO_FULL_NAME>
Example:
./github_access_scripts/check_repo_access.sh DARKenergem saravanakumardb/vv-note-mcp-agent-intern-naman
list_user_repos.sh
This script attempts to list all repositories a given user has access to, by scanning through the repositories of the accounts listed in accounts.json.
Note: This script has limitations. It only checks for access on repositories that the authenticated users (from accounts.json) are members of. It may not find all repositories a user has access to if they have access to repos outside of those organizations/users. For checking access to a specific repository, check_repo_access.sh is more reliable.
Command:
./github_access_scripts/list_user_repos.sh <GITHUB_USER_NAME>
GitHub Repository Scanners
This directory (github_repo_scanners) contains scripts for more advanced repository scanning and data extraction.
create_user_repo_lists.sh
This script scans all accounts in accounts.json and creates a JSON file for each user containing a list of repositories they have access to.
Command:
./github_repo_scanners/create_user_repo_lists.sh <path_to_accounts.json>
Example:
./github_repo_scanners/create_user_repo_lists.sh accounts.json
create_contributor_repo_lists.sh
This script scans all accounts in accounts.json, finds all contributors to their repositories, and creates a JSON file for each contributor listing the repositories they have contributed to.
Command:
./github_repo_scanners/create_contributor_repo_lists.sh <path_to_accounts.json>
Example:
./github_repo_scanners/create_contributor_repo_lists.sh accounts.json
Note on File Visibility: In some environments, tools like
list_directoryorread_filewithin certain CLI agents might experience caching or synchronization issues, leading to files not appearing immediately after creation, even if the underlying shell commands confirm their existence. If you encounter such issues, direct shell commands (ls,cat) might provide more accurate results.
Example:
./github_access_scripts/list_user_repos.sh DARKenergem