Skip to content

Instantly share code, notes, and snippets.

@barseghyanartur
Last active February 2, 2023 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barseghyanartur/e9f3a2ebbb920405fcbd2e18ac87c9d1 to your computer and use it in GitHub Desktop.
Save barseghyanartur/e9f3a2ebbb920405fcbd2e18ac87c9d1 to your computer and use it in GitHub Desktop.
Globally prevent `cargo new` from creating `.git` directories inside newly created packages

Globally prevent cargo new from creating .git directories inside newly created packages

Problem

When calling cargo new package_name, cargo by default creates a .git/ directory inside the newly created package. If that's not something that you want, continue reading.

Solution

Modify global Cargo config file

On Linux, it's typically ~/.cargo/config.toml, but other options are valid too.

If it doesn't exist yet - create one

~/.cargo/config.toml

[cargo-new]
vcs = "none"

That's it!

P.S. There are more options to explore. See this for further reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment