diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index 98845d1f4..ccf5d9118 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -769,6 +769,10 @@ impl InitProjectKind { ) -> Result<()> { fs_err::create_dir_all(path)?; + // Initialize the version control system first so that Git configuration can properly + // read conditional includes that depend on the repository path. + init_vcs(path, vcs)?; + // Do no fill in `authors` for non-packaged applications unless explicitly requested. let author_from = author_from.unwrap_or_else(|| { if package { @@ -828,9 +832,6 @@ impl InitProjectKind { } fs_err::write(path.join("pyproject.toml"), pyproject)?; - // Initialize the version control system. - init_vcs(path, vcs)?; - Ok(()) } @@ -855,6 +856,10 @@ impl InitProjectKind { fs_err::create_dir_all(path)?; + // Initialize the version control system first so that Git configuration can properly + // read conditional includes that depend on the repository path. + init_vcs(path, vcs)?; + let author = get_author_info(path, author_from.unwrap_or_default()); // Create the `pyproject.toml` @@ -880,9 +885,6 @@ impl InitProjectKind { generate_package_scripts(name, path, build_backend, true)?; } - // Initialize the version control system. - init_vcs(path, vcs)?; - Ok(()) } }