FIX: Git should not prompt for credentials (#15062)

When cloning a public remote repository (no key), git should not prompt
for credentials.
This commit is contained in:
Dan Ungureanu
2021-11-23 13:54:51 +02:00
committed by GitHub
parent c749b41163
commit ff7acc9828
2 changed files with 5 additions and 5 deletions

View File

@ -87,9 +87,9 @@ class ThemeStore::GitImporter
def import_public!
begin
if @branch.present?
Discourse::Utils.execute_command("git", "clone", "--single-branch", "-b", @branch, @url, @temp_folder)
Discourse::Utils.execute_command({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", "--single-branch", "-b", @branch, @url, @temp_folder)
else
Discourse::Utils.execute_command("git", "clone", @url, @temp_folder)
Discourse::Utils.execute_command({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", @url, @temp_folder)
end
rescue RuntimeError
raise RemoteTheme::ImportError.new(I18n.t("themes.import_error.git"))