Skip to main content

Using Local Repositories

If you already have a repository on your local machine, you can skip the cloning step and process it directly. This is useful for:
  • Converting private repositories without authentication
  • Processing repositories you’re actively developing
  • Working offline or with limited network access
  • Converting repositories from other Git hosting services
  • Faster processing by avoiding the clone step

How It Works

When you select the local repository option, repo2pdf processes files directly from the directory you specify instead of cloning from GitHub.
1

Select Local Repository

When prompted, choose Yes to use a local repository:
? Do you want to use a local repository? (Use arrow keys)
  No
 Yes
2

Provide Directory Path

Enter the full absolute path to your local repository:
? Please provide the full path to the local repository: /home/user/projects/my-app
The path must exist on your filesystem. The tool validates the directory exists before proceeding.
3

Configure Features

Select your desired features just like with remote repositories:
? Select the features you want to include: (Press <space> to select)
 Add line numbers
 Add highlighting
 Add page numbers
 Remove comments
 Remove empty lines
 One PDF per file
4

Set Output Options

Specify the output filename or folder name:
? Please provide an output file name: my-project.pdf

Key Differences

No Cloning Step

With local repositories, the tool skips the Git clone operation:
 Setting everything up
 Processing files... (47 processed)
 PDF created with 47 files processed.
Notice there’s no “Repository cloned successfully” message.

No Repository Cleanup

Since the tool uses your existing directory, you won’t be prompted to keep or delete the repository. Your local files remain untouched.
# This prompt only appears for remote repositories
? Do you want to keep the cloned repository?

Path Validation

The tool validates that the path you provide exists using Node.js’s fs.existsSync():
validate: function (value: string) {
  if (fs.existsSync(value)) {
    return true;
  } else {
    return "Please enter a valid directory path.";
  }
}
If the path doesn’t exist, you’ll see an error:
? Please provide the full path to the local repository: /invalid/path
>> Please enter a valid directory path.

Supported Path Formats

Use absolute paths starting from root:
/home/username/projects/my-repo
/Users/username/Documents/repos/my-project
Or use the tilde for home directory:
~/projects/my-repo
~/Documents/repos/my-project

Example Workflow

Here’s a complete example of converting a local repository:
$ repo2pdf

  ██████╗ ███████╗██████╗  ██████╗         ██████╗         ██████╗ ██████╗ ███████╗
  ██╔══██╗██╔════╝██╔══██╗██╔═══██╗        ╚════██╗        ██╔══██╗██╔══██╗██╔════╝
  ██████╔╝█████╗  ██████╔╝██║   ██║         █████╔╝        ██████╔╝██║  ██║█████╗
  ██╔══██╗██╔══╝  ██╔═══╝ ██║   ██║        ██╔═══╝         ██╔═══╝ ██║  ██║██╔══╝
  ██║  ██║███████╗██║     ╚██████╔╝        ███████╗        ██║     ██████╔╝██║
  ╚═╝  ╚═╝╚══════╝╚═╝      ╚═════╝         ╚══════╝        ╚═╝     ╚═════╝ ╚═╝

  Welcome to Repo-to-PDF! Let's get started...

✔ Setup complete

? Do you want to use a local repository? Yes
? Please provide the full path to the local repository: /home/user/my-app
? Select the features you want to include: Add line numbers, Add highlighting
? Please provide an output file name: my-app.pdf

Processing your request...

✔ Processing files... (23 processed)
✔ PDF created with 23 files processed.

Working with Non-Git Directories

The directory doesn’t need to be a Git repository. Any directory structure works, as the tool processes files based on directory traversal, not Git metadata.
This means you can convert:
  • Git repositories (.git directory is automatically excluded)
  • Plain directories with source code
  • Extracted archives
  • Project templates

File Exclusions Apply

The same exclusion rules apply to local repositories:
  • Universal excluded names (.git, node_modules, etc.)
  • Universal excluded extensions (.png, .jpg, .yml, etc.)
  • Custom exclusions via repo2pdf.ignore file
See Configuration - Custom Exclusions for details.

Use Cases

Private Development

Convert private repositories without setting up Git authentication

Non-GitHub Repos

Process repositories from GitLab, Bitbucket, or other services

Offline Work

Generate PDFs without internet connectivity

Active Development

Convert your current working directory with uncommitted changes

Performance Benefits

Using local repositories is faster because it skips:
  1. Network latency for cloning
  2. Downloading repository data
  3. Temporary directory cleanup
For large repositories, this can save significant time.
Ensure you have read permissions for all files in the directory. Permission errors will cause the tool to fail during file processing.

Next Steps