Skip to content

Commit

Permalink
fix(git): set GIT_TERMINAL_PROMPT=0 env variable
Browse files Browse the repository at this point in the history
> If this Boolean environment variable is set to false, git
> will not prompt on the terminal (e.g., when asking for
> HTTP authentication).

As explained by the git docs this prevents private or deleted
repositories from blocking the clone process by asking for
credentials. Unfortunately, this doesn't seem to stop git
from prompting about ssh key authenticity.
  • Loading branch information
paolobarbolini committed Apr 2, 2024
1 parent eda421e commit 4790baf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ fn main() -> Result<()> {
.arg("clone")
.arg(repository.to_string())
.arg(&repo_dir)
.env("GIT_TERMINAL_PROMPT", "0")
.output()?;
if !out.status.success() {
println!("Couldn't clone {} repo status={}", repository, out.status);
Expand Down Expand Up @@ -384,6 +385,7 @@ fn main() -> Result<()> {
let out = Command::new("git")
.arg("submodule")
.arg("init")
.env("GIT_TERMINAL_PROMPT", "0")
.current_dir(&repo_dir)
.output()
.context("init submodules")?;
Expand All @@ -398,6 +400,7 @@ fn main() -> Result<()> {
let out = Command::new("git")
.arg("submodule")
.arg("sync")
.env("GIT_TERMINAL_PROMPT", "0")
.current_dir(&repo_dir)
.output()
.context("sync submodules")?;
Expand All @@ -412,6 +415,7 @@ fn main() -> Result<()> {
let out = Command::new("git")
.arg("submodule")
.arg("update")
.env("GIT_TERMINAL_PROMPT", "0")
.current_dir(&repo_dir)
.output()
.context("update submodules")?;
Expand Down

0 comments on commit 4790baf

Please sign in to comment.