Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Interact with Gemini CLI
/ 20
Use Gemini non-interactive mode
/ 20
Use Gemini CLI in Shell mode
/ 20
Ask Who am I on github?
/ 20
Push changes to a Github repository
/ 20
Vibe coding is an emerging software development practice that uses artificial intelligence (AI) to generate functional code from natural language prompts, accelerating development, and making app building more accessible, especially for those with limited programming experience.
The term, coined by AI researcher Andrej Karpathy in early 2025, describes a workflow where the primary role shifts from writing code line-by-line to guiding an AI assistant such as Gemini CLI to generate, refine, and debug an application through a more conversational process. This frees you up to think about the big picture, or the main goal of your app, while the AI handles writing the actual code.
Gemini CLI is an open-source AI agent that brings the power of Gemini directly into your terminal. The Gemini CLI project is open source and you can view the public roadmap to learn more about functionality enhancements, upcoming features, and bug fixes.
In this lab, you learn how to perform the following tasks:
This lab can be run entirely within Google Cloud Shell, which comes pre-installed with Gemini CLI.
This lab is designed for users and developers of all levels (including beginners).
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud, in Google Cloud, refer to the gcloud CLI overview guide.
In order to support scoring for some of the tasks in this lab, you need to enable Cloud Logging on Gemini CLI.
The Gemini CLI's behavior is controlled by configuration files and environment variables. There are two key files:
.gemini/settings.json: This file controls the configuration of the CLI including how to connect to external tools.
GEMINI.md: This file provides natural language guidelines and context to the model. The CLI reads this file to understand your project's coding standards and conventions.
When you use Cloud Shell to run Gemini, a default theme for Gemini CLI and the authentication method is already selected and configured for you.
The file that Gemini CLI uses to "remember" your preferences is called settings.json and you can also use it to customize Gemini CLI.
In Cloud Shell, this file is located in the following directory:
~/.gemini/settings.json.
While you can configure some of Gemini CLI's behavior through the settings.json file located in the ~/.gemini/ directory, another file you can use to configure Gemini CLI's behavior is GEMINI.md.
The GEMINI.md file is the context file (defaulting to GEMINI.md but configurable via the contextFileName property in settings.json file) that is crucial for configuring the instructional context (also referred to as "memory") provided to the Gemini model.
This file allows you to give project-specific instructions, coding style guides, or any relevant background information to the AI, making its responses more tailored and accurate to your needs.
The GEMINI.md file is in Markdown format.
What does a GEMINI.md file contain? Here is the content from an example produced based on the official Gemini CLI documentation.
Sample GEMINI.md file:
You may notice that the sample GEMINI.md file provides some general instructions plus very specific instructions for coding style, dependency management and more. In a similar manner, you could write your own guidelines based on your programming language, framework, coding style, and other project-specific preferences.
The GEMINI.md file is the key to making Gemini CLI follow your preferences. For more information, you can refer to the Practical Gemini CLI series, which dives deeper into how you can auto-generate such a file for your project, customize the System Prompt, and more.
Before you get started in Gemini CLI, you need to create a folder to use as your home folder for all the projects that you may create inside of it. This is a starting point for the Gemini CLI to work with, although it may reference some other folders on your system, as needed.
gemini-cli-projects, and navigate to it:settings.json configuration file:In Cloud Shell, Gemini CLI is pre-installed.
When you use Gemini CLI for the first time, it may ask you to choose an authentication method.
Once you are successfully authenticated, the Gemini CLI is ready and waiting for your command. A sample screenshot is as follows:
For now, you can quit the Gemini CLI because you start working with the model in more detail in the task that follows.
/quit command, to exit Gemini CLI.In this task, you get started with Gemini CLI. For scoring functionality in this lab to be stable, you first install a specific version of Gemini CLI. Then, because you want to start working within the project-specific folder that you created for this purpose, you start a new Gemini session.
Run the following command to launch Gemini CLI and start a new session:
Copy and paste the following and then press ENTER to prompt Gemini CLI with your first query:
The expected response is as follows.
Output:
You may notice that your query resulted in a GoogleSearch tool (a built-in tool in Gemini CLI) that gets invoked. You learn more about built-in tools later on in this lab.
Click Check my progress to verify the objective.
/help (forward slash) to receive a variety of commands and keyboard shortcuts as follows:The /help command is one example of a so-called slash command. You can refer to the Slash Commands (/) documentation to learn more about these built-in Gemini CLI commands.
Gemini CLI comes with a set of built-in tools, which the Gemini model uses to interact with your local environment, access information, and perform actions. These tools enhance the CLI's capabilities, enabling it to go beyond text generation and assist with a wide range of tasks.
You can refer to the tools documentation for more detail.
/tools command:
Sample output:
Can Gemini CLI simply call these tools, when it wants to? The simple answer is no. By default, the model always asks for permission when it comes to sensitive operations that might involve writing to the local system, reading from an external system, going to the external network, and so on.
While there is a --yolomode available when you start the CLI (not typically recommended), you may find that Gemini CLI prompts you for permission to run the tool that it has chosen. You can refuse permission, let it run once, or give it blanket permission to always run. You are and should be in full control of things.
In this section, you issue a prompt to make Gemini CLI choose and execute one of its built-in tools for you to gain a better understanding of how it all works.
Let's say you would like to get information on the latest financial news across the world and save that into a file in the local working directory from where you launched Gemini CLI.
The first thing it does is that it invokes the GoogleSearch tool to search the web.
Once the search is complete, it retrieves the data as follows:
Once that is done, it is ready to write this to the file and it uses the WriteFile tool, but since that is a sensitive operation (write), it asks for your permission. You can decide the permission type i.e. allow once, allow always, etc.
This then writes the information to the file and a success message is shown as follows.
Expected output:
If you want to check if a file is written or not, you can use the @file to ask it to read the content. As you type @, it displays a list of files in the current folder, including the file it has just created.
-m parameter followed by the model name:
gemini -m "gemini-2.5-flash"While Gemini CLI is running, you can verify the model that's running at the bottom right of the Gemini CLI terminal as in the following screenshot:
An interesting option is to run Gemini CLI in a non-interactive mode. This means that you directly provide it the prompt and it goes ahead and responds to it, without the Gemini CLI interactive terminal opening up. This is very useful if you plan to use Gemini CLI in an automated fashion as part of a script or any other automation process.
Quit the session (press CTRL+D or CTRL+C twice, or issue the /quit prompt).
In Cloud Shell, run the following command with the -p parameter:
Do keep in mind that in non-interactive mode, there is no scope to continue the conversation with follow-up questions. This mode also does not allow you to authorize tools (including WriteFile) or to run shell commands.
Click Check my progress to verify the objective.
It's also possible to work directly with the Shell from within Gemini CLI.
! in the prompt box. This toggles to a Shell mode.When in shell mode, you see the ! at the start of the prompt as shown in the following:
When in shell mode, you can directly use standard commands like pwd, cat, and ls, for example.
Let's now try printing the contents of a file via the cat command.
Example output:
! again or press the ESC key to exit Shell mode.Click Check my progress to verify the objective.
An MCP server is an application that exposes tools and resources to the Gemini CLI through the Model Context Protocol, allowing it to interact with external systems and data sources. MCP servers act as a bridge between the Gemini model and your local environment or other services like APIs.
An MCP server enables the Gemini CLI to discover and execute tools thereby extending Gemini CLI's capabilities to perform actions beyond its built-in features, such as interacting with databases, APIs, custom scripts, or specialized workflows.
Gemini CLI supports configuring MCP Servers for discovering and using custom tools.
/mcp command as follows:If you have not configured any MCP servers, it launches Gemini CLI's MCP Server documentation.
You can configure MCP servers at the global level in the ~/.gemini/settings.json file or in your project's root directory.
If you have Gemini CLI running, you can quit the session by pressing CTRL+D or CTRL+C twice.
.gemini subdirectory is hidden by default, select View > Toggle hidden files to show hidden files and directories..gemini/settings.json file within your project-specific folder, gemini-cli-projects.Within the ~/.gemini/settings.json file, you need to configure the mcpServers configuration block. It takes the following syntax:
You configure this file to support an MCP server in the next task.
Each server configuration supports the following properties, as per the Reference documentation:
Optional
The Github official MCP Server provides sufficient documentation on the tools that it exposes along with how to configure the same. You have the option of running it locally or remotely, since Gemini CLI supports remote MCP servers too.
In this section, you set up a Remote MCP Server in Github. For this, you need to have a Personal Access Token (PAT) from Github first.
Then, you need to add the MCP Server object in the settings.json file to point to the Github MCP Server configuration.
In this section, you create your classic Github PAT, set the token lifetime to never expire, and allow it all available permissions.
For more detail, you can refer to the Creating a personal access token (classic) Github documentation to create your own PAT.
Run the following command in Cloud Shell to open the settings.json file in the Cloud Shell Editor:
Edit the settings.json file (yours should currently resemble the following example):
Now insert your PAT to replace the [placeholder] after "Bearer " and insert this JSON after the first brace at the top of the file:
You might have additional settings in settings.json, but the final result should be formatted similar to the following:
settings.json file loaded at startup, which activates the configured Github MCP server:/mcp prompt.The screenshot that follows highlights the Github MCP server that is configured on a machine and the various tools that are now available to the Gemini CLI to work with MCP.
Sample output:
Next, you issue a prompt to invoke one of the tools from the Github MCP Server.
Expected output:
Notice that it picks the correct tool from the Github MCP server but as with other built-in tools, this also requires that you provide explicit permission to invoke the tool.
Click Check my progress to verify the objective.
Now that the Github MCP server is configured, you could give your queries in natural language as follows to work with one of your Github projects:
Here is an additional list of MCP servers that you might be interested in:
The instructions for setting up these MCP servers are published in this blog post.
In this task, you use Gemini CLI to vibe code a website. You ask Gemini CLI to generate the structure of the website and set it up.
Gemini CLI proceeds to go through a series of actions at this point.
The next few prompts and responses are a sample flow that was observed. You might get a completely different response.
You need to interact back-and-forth with Gemini CLI, as needed.
At times, Gemini CLI may suggest a command that it would like to execute. For the purposes of this lab, you should exert control over the task.
If the model offers to run a command, you can simply press ESC to escape out and redirect its approach with a message such as the following:
On following the instructions to start the server and navigate to the home page, you get a sample site as shown (you should see a variant of a similar site if you used the same prompt):
You are free to keep making more changes with the help of Gemini CLI.
Now that you are satisfied with the website, in this section you use the remote Github MCP Server you configured in Task 5 to push your changes to a Github repository that you create.
First up, you create a .gitignore file with the help of Gemini CLI.
Next, you give instructions to Gemini CLI to push this repository under the Github account (this should exercise the Github MCP server tools in the background).
[Your-name] placeholder with your name):Gemini CLI goes through a number of commands at this point:
If all goes well, you should have a Github repository in place. A sample screenshot is as follows:
Well done! You have created a website with the help of Gemini CLI and pushed changes to a Github repository that you created.
README.md file for the project in this lab, but doing so would be recommended in a real-life production environment. If you'd like, you can ask Gemini CLI to do so for you.Click Check my progress to verify the objective.
Congratulations, you've successfully explored Gemini CLI, its capabilities, and applied it to a use case.
Manual Last Updated October 16, 2025
Lab Last Tested October 16, 2025
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one