> For the complete documentation index, see [llms.txt](https://datalab-docs.datacamp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://datalab-docs.datacamp.com/work/github.md).

# Git and GitHub

You can configure and work with Git by leveraging [Environment variables](/work/environment-variables.md). This way, you don't need to enter these details every time you want to push to or pull from a Git repository.

The following environment variables are required to connect to a Git repository. You can choose the name for this set of environment variables freely.

* `GIT_AUTHOR_EMAIL`
* `GIT_AUTHOR_NAME`
* `GIT_COMMITTER_EMAIL`
* `GIT_COMMITTER_NAME`
* `GIT_USERNAME`
* `GIT_PASSWORD`  (see below for instructions for GitHub)

![The required environment variables to connect to GitHub, the collection name can be chosen freely](/files/oFERkzu6kIkxFEw656vr)

After setting up your environment variables and connecting them to your workbook, you can open a terminal by opening the **Run** menu and choosing **Open Terminal**. Run the following command:

```
$ git clone <repository_url>
```

This command will clone your git repository in a new folder using the name of the repository as the name of the folder. In order to clone into the top level directory of your workbook, the directory your terminal opens up in, you can append `.` to the command. This will only work if the current directory is empty.

```
$ git clone <repository_url> .
```

### GitHub

In order to connect to GitHub, the `GIT_PASSWORD` environment variable should be a Personal Access Token (PAT). See the [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create a PAT with the right permissions.

After configuring and connecting the environment variables, you can open a terminal by opening the **Run** menu and choosing **Open Terminal**. Now you can clone a private repository for example. Make sure to use the web URL of the GitHub repository, starting with `https://`:

```
$ git clone https://github.com/<user>/<private-repo>.git
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://datalab-docs.datacamp.com/work/github.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
