boolean isUseNativeSSH();
+ boolean isUseGitSshCommand();
+
boolean isUseLocalMirrors(@NotNull GitVcsRoot root);
boolean isUseAlternates(@NotNull GitVcsRoot root);
private boolean myRepeatOnEmptyOutput = false;
private VcsRootSshKeyManager mySshKeyManager;
private boolean myHasProgress = false;
+ private boolean myUseGitSshCommand = true;
public GitCommandLine(@Nullable GitAgentSSHService ssh,
@NotNull ScriptGen scriptGen,
}
}
if (settings.isUseNativeSsh()) {
- if (!myGitVersion.isLessThan(UpdaterImpl.MIN_GIT_SSH_COMMAND) && authSettings.getAuthMethod() == AuthenticationMethod.TEAMCITY_SSH_KEY) {
+ if (!myGitVersion.isLessThan(UpdaterImpl.MIN_GIT_SSH_COMMAND) && authSettings.getAuthMethod() == AuthenticationMethod.TEAMCITY_SSH_KEY && myUseGitSshCommand) {
configureGitSshCommand(authSettings);
}
return CommandUtil.runCommand(this, settings.getTimeout());
mySshKeyManager = sshKeyManager;
}
+ public void setUseGitSshCommand(boolean useGitSshCommand) {
+ myUseGitSshCommand = useGitSshCommand;
+ }
+
public void addEnvParam(@NotNull String name, @NotNull String value) {
Map<String, String> existing = getEnvParams();
if (existing == null)
NativeGitFacade git = new NativeGitFacade(mySsh, myPluginConfig.getPathToGit(), myPluginConfig.getGitVersion(), repositoryDir,
myTmpDir, myPluginConfig.isDeleteTempFiles(), myLogger, myPluginConfig.getGitExec(), myEnv, myCtx);
git.setSshKeyManager(mySsh.getSshKeyManager());
+ git.setUseGitSshCommand(myPluginConfig.isUseGitSshCommand());
return git;
}
}
private final Map<String, String> myEnv;
private final Context myCtx;
private VcsRootSshKeyManager mySshKeyManager;
+ private boolean myUseGitSshCommand = true;
public NativeGitFacade(@NotNull GitAgentSSHService ssh,
@NotNull String gitPath,
cmd.setExePath(myGitPath);
cmd.setWorkingDirectory(myRepositoryDir);
cmd.setSshKeyManager(mySshKeyManager);
+ cmd.setUseGitSshCommand(myUseGitSshCommand);
return cmd;
}
mySshKeyManager = sshKeyManager;
}
+ public void setUseGitSshCommand(boolean useGitSshCommand) {
+ myUseGitSshCommand = useGitSshCommand;
+ }
+
@NotNull
private ScriptGen makeScriptGen() {
return SystemInfo.isUnix ? new UnixScriptGen(myTmpDir, new EscapeEchoArgumentUnix()) : new WinScriptGen(myTmpDir, new EscapeEchoArgumentWin());
public static final String IDLE_TIMEOUT = "teamcity.git.idle.timeout.seconds";
public static final String USE_NATIVE_SSH = "teamcity.git.use.native.ssh";
+ public static final String USE_GIT_SSH_COMMAND = "teamcity.git.useGitSshCommand";
public static final String USE_MIRRORS = "teamcity.git.use.local.mirrors";
public static final String USE_ALTERNATES = "teamcity.git.useAlternates";
public static final String USE_SHALLOW_CLONE = "teamcity.git.use.shallow.clone";
}
+ @Override
+ public boolean isUseGitSshCommand() {
+ String value = myBuild.getSharedConfigParameters().get(USE_GIT_SSH_COMMAND);
+ return !"false".equals(value);
+ }
+
public boolean isUseLocalMirrors(@NotNull GitVcsRoot root) {
String buildSetting = myBuild.getSharedConfigParameters().get(USE_MIRRORS);
if (!StringUtil.isEmpty(buildSetting)) {
private void logSshOptions(@NotNull GitVersion gitVersion) {
if (myPluginConfig.isUseNativeSSH()) {
logInfo("Will use native ssh (" + PluginConfigImpl.USE_NATIVE_SSH + "=true)");
- if (myRoot.getAuthSettings().getAuthMethod() == AuthenticationMethod.TEAMCITY_SSH_KEY && gitVersion.isLessThan(UpdaterImpl.MIN_GIT_SSH_COMMAND)) {
- logWarn("Git " + gitVersion + " doesn't support the GIT_SSH_COMMAND environment variable, uploaded SSH keys will not work. " +
- "Required git version is " + UpdaterImpl.MIN_GIT_SSH_COMMAND);
+ if (myRoot.getAuthSettings().getAuthMethod() == AuthenticationMethod.TEAMCITY_SSH_KEY) {
+ if (gitVersion.isLessThan(UpdaterImpl.MIN_GIT_SSH_COMMAND)) {
+ logWarn("Git " + gitVersion + " doesn't support the GIT_SSH_COMMAND environment variable, uploaded SSH keys will not work. " +
+ "Required git version is " + UpdaterImpl.MIN_GIT_SSH_COMMAND);
+ } else if (!myPluginConfig.isUseGitSshCommand()) {
+ logWarn("Use of GIT_SSH_COMMAND is disabled (" + PluginConfigImpl.USE_GIT_SSH_COMMAND + "=false), uploaded SSH keys will not work.");
+ }
}
}
}