I was trying to release a Jar and the gpg-agent was not starting. According to https://www.gnupg.org/documentation/manuals/gnupg-devel/Invoking-GPG_002dAGENT.html it should start automatically on any invocation of a GnuPG program but that doesn't seem to be true in WSL.
pupeno#DESKTOP-5N8VFOD:~$ gpg-agent
gpg-agent: no gpg-agent running in this session
For a moment I thought that maybe GnuPG would just not work in WSL, but I managed to started manually:
pupeno#DESKTOP-5N8VFOD:~$ eval $(gpg-agent --daemon)
pupeno#DESKTOP-5N8VFOD:~$ gpg-agent
gpg-agent: gpg-agent running and available
So, what's missing? Why isn't it starting automatically? or how should I start it?
You want gpg-agent to start automatically, so start it from ~/.bashrc.
echo 'eval $(gpg-agent --daemon)' >> ~/.bashrc
Related
I have executed the following command in Git Bash, and it returns the following error.
$ eval $(ssh-agent -s)
1 [main] ssh-agent 1564 child_info_fork::abort: \??\C:\Program Files\Git\usr\bin\msys-
crypto-1.1.dll: Loaded to different address: parent(0x8A0000) != child(0x910000)
fork: Resource temporarily available
I have also tried restarting my system, that doesn't do any good.
Any Ideas what this issue is all about, or how to fix it, if possible?
Thanks in advance! 😉👍
Make sure first in a CMD session to:
upgrade to the latest Git for Windows
the PATH correctly set to Git, for testing.
That is:
set GH=C:\path\to\git
set PATH=C:\windows\system32;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
Then, in that same CMD session, type git bash and try again
I confess I am total newbie to Jenkins.
I have
Jenkins-tls
installed on my Mac for experimentation.
I have a remote server that I testing with.
My Jenkins script is ultra simple.
ssh to the remote machine
sudo pm2 ls
the last command just hangs
I run the same 2 commands from the command line and it all works perfectly.
FYI, I need sudo for pm2 since I need to be root to run pm2, without sudo, I get access denied.
Any thoughts?
I believe you make the invalid assumption that jenkins somehow "types" commands after starting ssh to the remote session's command shell. This is not what happens. Instead, it will wait for the ssh command to finish, and only then execute the next command sudo pm2 ls. This never happens, because the ssh session never terminates. You observe this as a "hang".
How to solve this?
If there's only a small number of commands, you can use ssh to run them with
ssh user#remote sudo mp2 ls
ssh user#remote command arg1 arg2
If this gets longer, why not place all commands in a remote script and just run it with
ssh user#remote /path/to/script
I have a minikube K8s 1 node cluster on my Windows 10 pc. I can SSH into this cluster using minikube ssh.
The problem that I am experiencing is that I can't use the arrow keys to bring back the previous command. I did some looking around and diagnostics:
set -o | grep history gave history on
echo $HISTFILE gave /home/docker/.bash_history. This is indeed in the home folder of the user and the file was present after exiting and executing minikube ssh again
echo $HISTSIZE and echo $HISTFILESIZE both gave 500
echo $SHELL gave /bin/bash
All these things tell me that command history should be enabled, but it doesn't seem to be the case.
I tried using both Powershell and cmd to run minikube ssh, both with and without Windows Terminal.
Both PowerShell and cmd themselves have a working command history, but once SSHing using minikube, the history in the bash shell doesn't work.
Does anyone know how to get the command history to work after executing minikube shh?
Edit:
I have tried minikube ssh --native-ssh=false, but this didn't change anything.
It seems to be a problem with the SSH client you are using. You can try with the --native-ssh=false option:
minikube ssh --native-ssh=false
You can also try with different alternatives or with something like the ssh version that comes with Cygwin.
There is already an unsolved issue related to this. (Feel free to update)
✌️
I am installing nvm inside docker. After I've finished installing it says to run echo ". ~/.nvm/nvm.sh" >> ~/.bash_profile and then close and reopen terminal.
I think the above procedure updates bash profile and let me access nvm.sh from bash with nvm command. But, to do this, I have to close and reopen bash/terminal.
Is there anyway to do this or I've to stop docker container and then run it again?
Maybe this will help with docker, to run scripts in running docker image, you can attach it to bash, reopen the instance with new profile:
docker ps -all #to get container id
docker exec -i -t 38ad5f94df4d /bin/bash
-t container id or container name
~/.bash_profile is sourced only by login instances of bash, presumably thats why they have said you to logout and then login.
If the only change you have made to ~/.bash_profile is adding the . ~/.nvm/nvm.sh, then you can have the same effect as far as the shell is concerned by source-ing the file in the current shell instance:
. ~/.nvm/nvm.sh
This of course covers only the bash's aspect, not docker as a whole.
Normally when I login to my server via putty, I am able to use nvm, grunt, gulp commands but if I connect with php's ssh2 extension or with sshpass through a bash script those commands are not working unless if I execute this commands first:
~/.nvm/nvm.sh
source ~/.profile
nvm current
And this is my ~/.profile file:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
What seems to be issue ? Why I need to execute this commands every time with automation tools such as ssh2 or sshpass ?
My OS is ubuntu 16.04
This has nothing to do with sshpass. You can verify this by running the ssh session without sshpass, and you will see that even if you manually enter the password, it will still not work.
When you run ssh with a command after it, it starts a remote shell that is not connected to a TTY, and that shell is not considered a login shell. For non-login shells, .profile simply isn't run.
The simple solution this problem is to move the environment setup from .profile to .bashrc. .bashrc is run even for non-interactive shells, and so should provide the environment setup you need.
As a side note, why are you using sshpass at all? Why not use the more secure public key authentication?
To clarify, the fact that the shell is not connected to a TTY is unrelated to your problem. At least for openssh, you can tell it to open a TTY even if a command to run is provided by specifying -t on the command line. .profile will still not be run.