The check_git_access.sh
script is a CLI tool designed to verify if the current user has permission to access a specified Git repository (clone or pull).
- Git: Ensure Git is installed on your system.
- Network Access: The script must be able to reach the repository URL.
- Download or create the script.
- Grant execution permission:
chmod +x check_git_access.sh
- Run the script with the Git repository URL:
./check_git_access.sh <repository_url>
check_git_access.sh <repository_url>
<repository_url>
: The URL of the Git repository to check.
./check_git_access.sh https://github.com/user/repo.git
./check_git_access.sh git@github.com:user/repo.git
- Checks for Git installation: Ensures Git is installed before proceeding.
- Validates repository URL: Ensures a repository URL is provided.
- Attempts remote access: Uses
git ls-remote
to check access permissions.
- 0: The user has access to the repository.
- 1: The user does not have permission or an error occurred.
- If access is denied, verify:
- The repository URL is correct.
- Authentication credentials (SSH key or Git credentials) are properly configured.
- Run manually:
git ls-remote <repository_url>
- Check network connectivity.
This script is provided as-is without warranties. Use at your own risk.
- Juan Enrique Chomon Del Campo
- Email: hola@juane.cl