0

I would like to be able to send an environmental variable when invoking, for example git clone over ssh:

git clone ssh://host.example/project

I know that this can be achieved by setting the SendEnv in ~/.ssh/config for host.example. Although I would like to avoid modifying any files. For example, with only ssh we could do:

ssh -o SendEnv=MYVAR server.example.com mycommand

and no file modification is necessary. Is there a similar way to achieve this when using git clone over ssh?

Cheers!

1 Answer 1

2

A Bash shell function can do this:

function e { echo $1; GIT_SSH=$1; export GIT_SSH; }

Substitute whatever Git functionality you need for the "echo $1".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.