# Setting An Environment Variable

Environment Variables can be specified in the following format:

```bash
echo "{environment_variable_name}={value}" >> $GITHUB_ENV
```

## Example

```yaml
steps:
    - name: Setting the environment variable
    run: |
        echo "GIT_VERSION=$(git --version)" >> $GITHUB_ENV

    - name: Check Git version
    run: |
        echo "${GIT_VERSION}"
```

**Note:** Can also use `${{ env.GIT_VERSION }}` format to get the environment variable value.

***Source:*** [***StackOverFlow***](https://stackoverflow.com/a/57969570)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.devjugal.com/github/actions/setting-an-environment-variable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
