Bash: line xx: xxxxxx: command not found while SSH into Remote

So the following output

/usr/bin/docker
/usr/local/bin/docker-machine
/usr/local/bin/docker-compose
/usr/local/bin/protoc
bash: line 23: goenv: command not found
bash: line 24: go: command not found
bash: line 25: go: command not found

So in my config.yml:

                ssh -o StrictHostKeyChecking=no -p 3022 tp-dev@71.171.106.102 "
                ...................
                goenv shell 1.9.2;
                go get github.com/micro/protobuf/{proto,protoc-gen-go}
                go get -v github.com/rubenv/sql-migrate/...;
                cd ./project;
                git pull;
                dep ensure;
                make proto;
                make build;
                make run;"

So in my remote server - ssh’ed in as user and I can run goenv and go after running goenv shell 1.9.2 - but for some reason only through circleci - it wont run.

Still investigating this…but if anyone can point out any mistakes or potential issue with my approach please let me know…Thanks!

I wonder if your PATH is different between the two cases? Try amending your unqualified calls above with qualified paths, e.g. /usr/bin/go or whatever.

Before I do that - I tried another test to do a “which goenv” and it returns blank, and goenv as remote user exists.

But let me see, if I can do that since goenv manages my go versions

@halfer - so it seems like my ~/.bashrc file isn’t being init’ed when I ssh into the remote through CircleCI - I confirmed it by exporting an env variable then echo’ed it in my command

ssh … “
echo $GOROOT
”

It outputted nothing…

To clarify - I even added . ~/.bashrc too in my command

1 Like

Ok I tried to run my command in my console - and it’s replicate-able, so my question is why doing

A. ssh … “
commands;
”

vs

B. ssh …
then terminal in

What … well why doesn’t A load my bashrc?

Actually the question I want to ask now is there a more programatical way of doing large scale ssh command line upon deploy? Or circleci only supports

|
ssh … "
commands
"

Ok the issue was that Linux OS’s references their bash profile differently - in my case I was using Ubuntu and I put my info into /etc/bash.bashrc at the top. So if you have a global export of directories and initiations - I put my stuff there and everything works now. Someone with more Linux background please provide more input and clarity or suggestions of where should one put their profile so it will be globally provided to all user