|
1 | 1 | # Authentication Setup |
2 | 2 |
|
3 | | -The Gemini CLI requires you to authenticate with Google's AI services. On initial startup you'll need to configure **one** of the following authentication methods: |
4 | | - |
5 | | -1. **Login with Google (Gemini Code Assist):** |
6 | | - - Use this option to log in with your Google account. |
7 | | - - During initial startup, Gemini CLI will direct you to a webpage for authentication. Once authenticated, your credentials will be cached locally so the web login can be skipped on subsequent runs. |
8 | | - - Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost url that Gemini CLI will be listening on). |
9 | | - - <a id="workspace-gca">Users may have to specify a GOOGLE_CLOUD_PROJECT if:</a> |
10 | | - 1. You have a Google Workspace account. Google Workspace is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. your-name@your-company.com), enhanced security features, and administrative controls. These accounts are often managed by an employer or school. |
11 | | - 1. You have received a Gemini Code Assist license through the [Google Developer Program](https://developers.google.com/program/plans-and-pricing) (including qualified Google Developer Experts) |
12 | | - 1. You have been assigned a license to a current Gemini Code Assist standard or enterprise subscription. |
13 | | - 1. You are using the product outside the [supported regions](https://developers.google.com/gemini-code-assist/resources/available-locations) for free individual usage. |
14 | | - 1. You are a Google account holder under the age of 18 |
15 | | - - If you fall into one of these categories, you must first configure a Google Cloud Project ID to use, [enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api) and [configure access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam). |
16 | | - |
17 | | - You can temporarily set the environment variable in your current shell session using the following command: |
18 | | - |
19 | | - ```bash |
20 | | - export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" |
21 | | - ``` |
22 | | - - For repeated use, you can add the environment variable to your [.env file](#persisting-environment-variables-with-env-files) or your shell's configuration file (like `~/.bashrc`, `~/.zshrc`, or `~/.profile`). For example, the following command adds the environment variable to a `~/.bashrc` file: |
23 | | - |
24 | | - ```bash |
25 | | - echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc |
26 | | - source ~/.bashrc |
27 | | - ``` |
| 3 | +Gemini CLI requires you to authenticate with Google's AI services. On initial startup you'll need to configure **one** of the following authentication methods: |
| 4 | + |
| 5 | +1. **Login with Google** |
| 6 | + 1. **Google AI Pro and AI Ultra subscribers** |
| 7 | + - Use this option to log in with your Google account that you use with Google AI Pro and Ultra. |
| 8 | + - During initial startup, Gemini CLI will direct you to a webpage for authentication. Once authenticated, your credentials will be cached locally so the web login can be skipped on subsequent runs. |
| 9 | + - Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost URL that Gemini CLI will be listening on.) |
| 10 | + 2. **Gemini Code Assist:** |
| 11 | + - Use this option to log in with your Google account. |
| 12 | + - During initial startup, Gemini CLI will direct you to a webpage for authentication. Once authenticated, your credentials will be cached locally so the web login can be skipped on subsequent runs. |
| 13 | + - Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost url that Gemini CLI will be listening on.) |
| 14 | + - <a id="workspace-gca">Users may have to specify a GOOGLE_CLOUD_PROJECT if:</a> |
| 15 | + 1. You have a Google Workspace account. Google Workspace is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. your-name@your-company.com), enhanced security features, and administrative controls. These accounts are often managed by an employer or school. |
| 16 | + 1. You have received a Gemini Code Assist license through the [Google Developer Program](https://developers.google.com/program/plans-and-pricing) (including qualified Google Developer Experts). |
| 17 | + 1. You have been assigned a license to a current Gemini Code Assist standard or enterprise subscription. |
| 18 | + 1. You are using the product outside the [supported regions](https://developers.google.com/gemini-code-assist/resources/available-locations) for free individual usage. |
| 19 | + 1. You are a Google account holder under the age of 18. |
| 20 | + - If you fall into one of these categories, you must first configure a Google Cloud Project ID to use, [enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api) and [configure access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam). |
| 21 | + |
| 22 | + You can temporarily set the environment variable in your current shell session using the following command: |
| 23 | + |
| 24 | + ```bash |
| 25 | + export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" |
| 26 | + ``` |
| 27 | + - For repeated use, you can add the environment variable to your [.env file](#persisting-environment-variables-with-env-files) or your shell's configuration file (like `~/.bashrc`, `~/.zshrc`, or `~/.profile`). For example, the following command adds the environment variable to a `~/.bashrc` file: |
| 28 | + |
| 29 | + ```bash |
| 30 | + echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc |
| 31 | + source ~/.bashrc |
| 32 | + ``` |
28 | 33 |
|
29 | 34 | 2. **<a id="gemini-api-key"></a>Gemini API key:** |
30 | 35 | - Obtain your API key from Google AI Studio: [https://aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey) |
|
0 commit comments