Skip to content

[Blog] Write a blog post on how to configure Gemini CLI for trusted directories #7297

@yi-nuo426

Description

@yi-nuo426

Contributors and community members are encouraged to post on https://layer5.io/blog. A new blog post fitting the following description is requested to be written by a community member:

Desired Title: gemini cli how to add trusted directories
Topic: Gemini CLI Configuration to avoid wasted time having to approve prompts.

Trusted directories can be added in the Gemini CLI through interactive prompts, commands, or by manually editing the configuration file.

Interactive Prompts
The CLI can prompt for trust settings.

When running the Gemini CLI in a new, untrusted folder, a dialog will appear.

Select Trust folder to trust the current directory. Select Trust parent folder to trust the current folder and all subdirectories.

To change the trust level for the current folder, run the /permissions command from within that directory to bring up the interactive dialog.

Commands for Multi-Directory Support

To give the CLI access to multiple directories, use the /directory command or the --include-directories flag.
To start a session with multiple directories:

gemini --include-directories path/to/dir1,path/to/dir2

Paths can be absolute or relative.

To add a new directory during an active session:

/directory add <path>

Multiple paths can be added, separated by commas.

To view all active directories:

/directory show

The alias /dir also works for these commands.

Manually Editing the Configuration File

Trusted folder rules are stored in a JSON file, which can be inspected or edited manually.
The file is located at ~/.gemini/trustedFolders.json in the home directory.

Edit this file directly to add or remove paths. Changes should take effect after restarting the CLI session.


Contributor Resources

The layer5.io website uses Gatsby, React, and GitHub Pages. Site content is found under the master branch.

Metadata

Metadata

Labels

area/blogNew posts or new blog functionalityframework/gatsbyGatsby relatedhelp wantedExtra attention is neededlanguage/markdownIssues or pull requests that use Markdown

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions