git-access
is a simple Bash script to interact with the GitHub API to check repository access and contributor information.
This repository contains a single Bash script, check-access.sh
, which provides a way to make authenticated GET requests to the GitHub API. The script retrieves information about contributors to a specified repository.
- Bash shell
- cURL
- GitHub Personal Access Token (PAT)
API_URL
: The base URL for the GitHub API (default:https://api.github.com
)USER_NAME
: Your GitHub username (set as an environment variable)TOKEN
: Your GitHub Personal Access Token (set as an environment variable)ORG_NAME
: The GitHub organization name (passed as the first argument)REPO_NAME
: The GitHub repository name (passed as the second argument)
-
Clone this repository:
git clone https://github.com/your-username/git-access.git cd git-access
-
Set your GitHub username and PAT as environment variables:
export username=your-username export token=your-personal-access-token
-
Run the script with the organization and repository name as arguments:
./check-access.sh organization_name repository_name
To get the list of contributors for a repository called example-repo
in the example-org
organization, you would run:
sh ./check-access.sh example-org example-repo
- Ensure your GitHub Personal Access Token has the necessary permissions to access the repository and retrieve contributor information.
- The script currently supports only the GET method for API calls.
Feel free to submit issues or pull requests if you have suggestions for improvements or find any bugs.