Skip to contents

This function creates a .gitignore file with enhanced security measures designed to help prevent accidental data leaks. The template includes comprehensive rules for common data file types and sensitive information.

Usage

write_ignore(path = here::here(), .initialize_proj = FALSE)

Arguments

path

Character string. Path to the project directory.

.initialize_proj

Logical. TRUE only if starting a froggeR::quarto_project().

Value

A .gitignore file with enhanced security rules. The file includes:
* R data files (.RData, .rda, .rds)
* Common data formats (CSV, Excel, text)
* System and temporary files
* IDE-specific files

Details

If a .gitignore file already exists, the user will be prompted before any overwriting occurs. The template provides substantial security enhancements over basic .gitignore files.

WARNING: Always consult your organization's data security team before using git with any sensitive or protected health information (PHI). This template helps prevent accidental data exposure but should not be considered a complete security solution.

Examples

# Create a temporary directory for testing
tmp_dir <- tempdir()

# Write the .gitignore file
write_ignore(path = tmp_dir)
#>  Created .gitignore
#>  Edit /tmp/RtmpQilr82/.gitignore.

# Confirm the file was created (optional, for user confirmation)
file.exists(file.path(tmp_dir, ".gitignore"))
#> [1] TRUE

# Clean up: Remove the created file
unlink(file.path(tmp_dir, ".gitignore"))