How to solve $SSH_ASKPASS error in IntelliJ (Win 10 x64) - windows

I use IntelliJ in Windows 10 x64. I can see all our GitHub repos there, but cloning fails:
CreateProcessW failed error:193 ssh_askpass: posix_spawnp: Unknown error git#github.com: Permission denied (publickey)
Git clone works fine via Git Bash & Win CLI. And my connection tests successfull via "SSH Configuration" in IntelliJ (it accepts my passphrase).
My SSH-related environment variables:
$GIT_SSH = C:\Windows\System32\OpenSSH\ssh.exe
$SSH_ASKPASS = /mingw64/bin/git-askpass.exe
I've unset $SSH_ASKPASS in "C:\Program Files\Git\etc\bash.bashrc". I've also set askPass = false in .gitconfig. echo $SSH_ASKPASS in Git Bash now yields NULL. But I still get the same error in IntelliJ.
Any idea how I might prevent (or remedy) IntelliJ's attempt to run ssh_askpass?

Related

scmStats plugin 0.3.1 works from windows cmd prompt but not from Jenkins job

I am running sonarqube 5.1.1 and sonar-runner-2.4 from windows 2012 r2 server
Java version--java version "1.8.0_20"
After running sonar-runner.bat from the command prompt the scm stats plugin is giving the correct output on the sonar dashboard. But when sonar-runner.bat is being run as jenkins (1.617) job it gives following error :
Executing: cmd.exe /X /C "git whatchanged "--until=2015-06-28 00:01:21 +0000" --date=iso -- C:\sonar_review."
17:01:21.375 INFO - Working directory: C:\sonar_review.
17:01:21.396 WARN - Fail to retrieve SCM info. Reason: The git-log command failed.
'git' is not recognized as an internal or external command,
operable program or batch file.
I am getting the same error in sonarqube 4.5.4 .
 'git' is not recognized as an internal or external command, operable program or batch file.
This is because Jenkins doesn't know where git is installed within your system.
You have to tell Jenkins the installation path of git.
For specifying the git path to Jenkins , go to manage Jenkins > configuring system > search for GIT and specify the git executable command.
Suppose you have git installed in c drive, you have to provide path till git.exe
This will definitely solve your issue.

Jenkins on Windows get stuck when git plugin execute ssh git-upload-pack

I'm trying to setup Jenkins on Windows server running in Azure.
I've install Jenkins, git and git-plugin on Windows 2012.
I'm trying to clone a very small repository from BitBicket and in Jenkins console I can see this line:
On the server itself there is a process of ssh that is hang with this command line:
c:\CI\Git\bin\ssh.exe -i "c:\Users\jenkins\AppData\Local\Temp\ssh663898192536328409key" -o StrictHostKeyChecking=no git#bitbucket.org "git-upload-pack'mycompany/myrepo.git'"
When I try to run this command in window cmd.exe I get this response, then the process stuck waiting for input and if I type something it exit with protocol error message:
00cbe160a5e558047c6dxy2d00694874365997d14f5 HEAD multi_ack thin-pack side-band
side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=git/1.8.5.2
003fe160a5e558047c6dcc37d00694874365997d14f5 refs/heads/master
0000
NOTE: When I git clone the same repository from git bash everything works great.
I didn't find the root cause but I did manage to get around it for now by generating a new key-pair WITHOUT password
For now it is enough and later I'll try to add password to the key-pair file.

TortoiseSVN post-commit hook fails on Win 7

I want to update remote staging server automatically after committing on my dev box.
I'm trying to setup TortoiseSVN post-commit hook on Win 7 64.
I have TortoiseGit installed in system with bunch of useful commands like 'ssh'
I created test.bat script that contains:
ssh -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup
This script running 'svn up' on remote staging server. And this test.bat file works fine when launched manually. But it not works in post-commit configuration. Blank console screen appearing and than TortoiseSVN showing an error:
Error: The hook script returned an error:
Error: 0 [main] ssh 2040 fhandler_base::dup: dup(some disk file) failed, handle 0, Win32 error 6
Error: dup() in/out/err failed
Could you advice?
UPD: I upgraded batch script to use full path.
"C:\Program Files (x86)\Git\bin\ssh.exe" -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup
But error still there. Now it has some new number
Error: The hook script returned an error:
Error: 0 [main] ssh.exe" 6976 fhandler_base::dup: dup(some disk file) failed, handle 0, Win32 error 6
Error: dup() in/out/err failed
Your hook probably cannot find ssh.
Using the full path name can help.
If that doesn't help changing the working directory to the location of ssh can help.
In the worst case you could add the location of ssh to the path, from within the batch file. This will only affect the path, during execution. I believe that a new shell is created by tortoise each time it's called.
As mentioned in the svn book:
For security reasons, the Subversion repository executes hook programs with an empty environment—that is, no environment variables are set at all, not even $PATH (or %PATH%, under Windows). Because of this, many administrators are baffled when their hook program runs fine by hand, but doesn't work when run by Subversion. Be sure to explicitly set any necessary environment variables in your hook program and/or use absolute paths to programs.
Which means your hook script doesn't know where to find ssh and what the current directory is (so using relative paths most likely won't work either).
Solution is to use plink.exe instead TortoiseGit ssh.exe.
And this will work:
c:\plink.exe -ssh -batch -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup

How to debug Jenkins error message "could not find a suitable ssh-agent provider"?

I'm using Jenkins on Win7 and i've installed tomcat for ssh-agent plugin. And I could clone my GitLab project via git bash via ssh.
But if I build the project by Jenkins, it always says :
[ssh-agent] Using credentials IliptonChen(APRTest)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
FATAL:[ssh-agent] Unable to start agent
The full output text is here
Did I do anything wrong?
Check the version of your ssh-agent used by Jenkins.
This bug (for linux, but could apply to Windows too) reports (10 days ago, January 2014) this very same error message:
"JENKINS-20276: Native Library Error after upgrading ssh-agent from 1.3 to 1.4".
Downgrading to 1.3 resolves the issue.
Update 2019, five years later: as commented, this should be fixed now.
ssh-agent.exe is part of a Git for Windows distribution
D:\git\git>where ssh-agent.exe
D:\prgs\gits\current\usr\bin\ssh-agent.exe
(provided path/to/git/usr/bin is first in the %PATH% used by Jenkins)
Assuming you've installed Windows Git on Windows slave, it comes with ssh-agent binary (e.g. C:\Program Files\Git\usr\bin). Try adding its path to system variable PATH.
Otherwise untick SSH Agent and choose the credentials by selecting Credentials from dropdown in Source Code Management section.
Another way is to generate personal API token (OAuth) for that GitHub user and include that along with your repository address, e.g.
git clone https://4UTHT0KEN#github.com/foo/bar
For windows, the plugin still requires Tomcat to be installed in both master and slave.
I got this error because I was using an Ubuntu image for the agent, which doesn't have SSH installed.
agent {
docker { image 'ubuntu:focal' }
}
... so the solution was as simple as installing SSH as part of the pipeline:
steps {
sh "apt-get update && apt-get install ssh -y"
// rest of your steps here...
}
In my case, the error was accompanied by an error about disk space depletion:
[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
[ssh-agent] Diagnostic report
[ssh-agent] * Exec ssh-agent (binary ssh-agent on a remote machine)
[ssh-agent] hudson.AbortException: Failed to run ssh-agent: mkdtemp: private socket dir: No space left on device
So I ran docker system prune -a, which fixed it.

Problems running svn+ssh from Jenkins in OS X using ssh keys

Trying to run a simple
svn list svn+ssh://...
from within jenkins on os X, as an execute shell step. The job is not linked to a SVN repository - I am trying to do an svn list manually on the tags folder without having jenkins downloading a copy of each tag.
but other jobs are connected to svn and jenkins checks out code fine.
I have downloaded jenkins from here which runs jenkins as a daemon
The problem is ssh keys. After a few iterations, here where I am at.
In /Library/LaunchDaemons/org.jenkins-ci.plist I have set JENKINS_HOME as /Users/Shared/Jenkins/Home (that's where jenkins gets installed), and in there I have created ssh keys, without passphrase (for now)
The actual command I am running is
svn --config-dir=/Users/Shared/Jenkins/Home/.subversion list svn+ssh://...
to get around jenkins running shell steps as root without actually having root permissions (not sure why - jenkins is launched by loading /Library/LaunchDaemons/org.jenkins-ci.plist) and causing a permission error when it tires to read /var/root/.servers
in --config-dir=/Users/Shared/Jenkins/Home/.subversion/config I have added
ssh = $SVN_SSH ssh -v -i /Users/Shared/Jenkins/Home/.ssh/id_rsa
so ssh can connect to the server. The last missing step now is that the shell expects the passphrase and cannot get it from Keychain (obviously)
debug1: read_passphrase: can't open /dev/tty: Device not configured
I thought leaving an empty passphrase would do the job, but it doesn't. Any clues? Thanks in advance.
I don't think there is a workaround to "read_passphrase: can't open /dev/tty: Device not configured" - the command expects terminal input and can't get it, nor can it get Keychain to provide it. It's all tied in with running as a daemon.
In the end I downloaded the latest version of the jenkins installer and re-installed to run manually and not as a daemon, so it runs as me instead of some weird flavour of root, and the problem disappeared.

Resources