> For the complete documentation index, see [llms.txt](https://til.devjugal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.devjugal.com/github/actions/setting-an-environment-variable.md).

# 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)
