Pass environment variables in your ssh session

You can pass local environment variables to your ssh session, and even use those to define environment variables inside your ssh session. For that, you need to execute a command which requires the flag -t prior to your server address. An example,

ssh -p 2222 -A -t myname@myserver "SERVER_ENV_VAR=$LOCAL_ENV_VAR; export SERVER_ENV_VAR; bash -l"

After that, you should see an environemnt variable called SERVER_ENV_VAR inside your ssh session.

[ ssh  env  ]