This guide provides detailed instructions on how to install, build, and configure the GitHub LOC Counter.
- For Building from Source: Java 17+ and Maven installed.
- For Prebuilt Binaries: Windows OS (for
.exe) or Linux OS (for.tar.gz).
- Clone the repository and navigate to the directory:
git clone https://github.com/sonle1501/github-loc.git cd github-loc - Build the project using Maven:
mvn clean package
- Run the generated
.jarfile:java -jar target/githubloc-1.0.jar <your-command>
- Go to the Releases section of this GitHub repository.
- Download the latest archive:
- For Windows: Download the
.ziparchive. - For Linux: Download the
.tar.gzarchive.
- For Windows: Download the
- Extract the downloaded file to your preferred directory.
- Run the executable directly via command line:
- Windows:
./github-loc.exe <your-command>
- Linux:
./github-loc <your-command>
- Windows:
By default, GitHub limits unauthenticated API requests to 60 per hour. Setting up a Personal Access Token (PAT) increases this rate limit and allows you to scan private repositories.
- Go to your GitHub account settings: Settings > Developer Settings > Personal access tokens > Fine-grained tokens (or classic tokens).
- Generate a new token with at least Metadata: Read-only (and Contents: Read-only if you want to scan private repositories).
Choose one of the following methods depending on how you run the application:
Create a file named token.properties in src/main/resources/ with the following content:
FINE_GRAINED_TOKEN=your_github_token_hereCreate a file in the same directory as the executable:
- Option A (
token.properties):FINE_GRAINED_TOKEN=your_github_token_here - Option B (
token.txt): Write only the token string inside:your_github_token_here
Warning
Keep your token file secure and never commit token.properties or token.txt to public version control. The repository includes these in .gitignore by default.