GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode

- 文章详细介绍了GitHub Copilot CLI两种工作模式:交互式适合实时代码建议,非交互式适用于批量生成代码。
- 通过实例演示如何在不同场景下配置和使用Copilot CLI,提升编程效率。
- 强调了GitHub Copilot作为AI辅助工具,在减少重复工作、启发创新解决方案方面的作用。
GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode - The GitHub Blog
Skip to contentSkip to sidebar
[](https://github.com/)/Blog
Try GitHub CopilotSee what's new
Learn about artificial intelligence and machine learning across the GitHub ecosystem and the wider industry.
Learn how to build with generative AI.
Change how you work with GitHub Copilot.
Everything developers need to know about LLMs.
Machine learning tips, tricks, and best practices.
Explore the capabilities and benefits of AI code generation and how it can improve your developer experience.
Learn more
Resources for developers to grow in their skills and careers.
Insights and best practices for building apps.
Tips & tricks to grow as a professional developer.
Improve how you use GitHub at work.
Learn how to move into your first professional role.
Stay current on what’s new (or new again).
Learn how to start building, shipping, and maintaining software with GitHub.
Learn more
Get an inside look at how we’re building the home for all developers.
Discover how we deliver a performant and highly available experience across the GitHub platform.
Explore best practices for building software at scale with a majority remote team.
Get a glimpse at the technology underlying the world’s leading AI-powered developer platform.
Learn how we build security into everything we do across the developer lifecycle.
Find out what goes into making GitHub the home for all developers.
Our engineering and security teams do some incredible work. Let’s take a look at how we use GitHub to be more productive, build collaboratively, and shift security left.
Learn more
Explore how to write, build, and deploy enterprise software at scale.
Automating your way to faster and more secure ships.
Guides on continuous integration and delivery.
Tips, tools, and tricks to improve developer collaboration.
DevOps resources for enterprise engineering teams.
How to integrate security into the SDLC.
Ensuring your builds stay clean.
Learn why Gartner positioned GitHub as a Leader for the second year in a row.
Learn more
Keep up with what’s new and notable from inside GitHub.
An inside look at news and product updates from GitHub.
The latest on GitHub’s platform, products, and tools.
Insights into the state of open source on GitHub.
The latest policy and regulatory changes in software.
Data-driven insights around the developer ecosystem.
Older news and updates from GitHub.
Learn how to use retrieval-augmented generation (RAG) to capture more insights.
Learn more
Everything open source on GitHub.
The latest Git updates.
Spotlighting open source maintainers.
How open source is driving positive change.
Explore open source games on GitHub.
Organizations worldwide are incorporating open source methodologies into the way they build and ship their own software.
Learn more
Stay up to date on everything security.
Application security, explained.
Demystifying supply chain security.
Updates from the GitHub Security Lab.
Helpful tips on securing web applications.
Learn about core challenges in DevSecOps, and how you can start addressing them with AI and automation.
Learn more
Search
Categories
Learn about artificial intelligence and machine learning across the GitHub ecosystem and the wider industry.
Learn how to build with generative AI.
Change how you work with GitHub Copilot.
Everything developers need to know about LLMs.
Machine learning tips, tricks, and best practices.
Explore the capabilities and benefits of AI code generation and how it can improve your developer experience.
Resources for developers to grow in their skills and careers.
Insights and best practices for building apps.
Tips & tricks to grow as a professional developer.
Improve how you use GitHub at work.
Learn how to move into your first professional role.
Stay current on what’s new (or new again).
Learn how to start building, shipping, and maintaining software with GitHub.
Get an inside look at how we’re building the home for all developers.
Discover how we deliver a performant and highly available experience across the GitHub platform.
Explore best practices for building software at scale with a majority remote team.
Get a glimpse at the technology underlying the world’s leading AI-powered developer platform.
Learn how we build security into everything we do across the developer lifecycle.
Find out what goes into making GitHub the home for all developers.
Our engineering and security teams do some incredible work. Let’s take a look at how we use GitHub to be more productive, build collaboratively, and shift security left.
Explore how to write, build, and deploy enterprise software at scale.
Automating your way to faster and more secure ships.
Guides on continuous integration and delivery.
Tips, tools, and tricks to improve developer collaboration.
DevOps resources for enterprise engineering teams.
How to integrate security into the SDLC.
Ensuring your builds stay clean.
Learn why Gartner positioned GitHub as a Leader for the second year in a row.
Keep up with what’s new and notable from inside GitHub.
An inside look at news and product updates from GitHub.
The latest on GitHub’s platform, products, and tools.
Insights into the state of open source on GitHub.
The latest policy and regulatory changes in software.
Data-driven insights around the developer ecosystem.
Older news and updates from GitHub.
Learn how to use retrieval-augmented generation (RAG) to capture more insights.
Everything open source on GitHub.
The latest Git updates.
Spotlighting open source maintainers.
How open source is driving positive change.
Explore open source games on GitHub.
Organizations worldwide are incorporating open source methodologies into the way they build and ship their own software.
Stay up to date on everything security.
Application security, explained.
Demystifying supply chain security.
Updates from the GitHub Security Lab.
Helpful tips on securing web applications.
Learn about core challenges in DevSecOps, and how you can start addressing them with AI and automation.
See what's newTry GitHub Copilot
GitHub Copilot CLI for Beginners: Interactive v. non-interactive mode
Learn the difference between CLI interactive v. non-interactive modes.

[Kayla Cinnamon](https://github.blog/author/cinnamonmsft/ "Posts by Kayla Cinnamon")·@cinnamon-msft
April 30, 2026
| 4 minutes
- Share:
- [](https://x.com/share?text=GitHub%20Copilot%20CLI%20for%20Beginners%3A%20Interactive%20v.%20non-interactive%20mode&url=https%3A%2F%2Fgithub.blog%2Fai-and-ml%2Fgithub-copilot%2Fgithub-copilot-cli-for-beginners-interactive-v-non-interactive-mode%2F)
- [](https://www.facebook.com/sharer/sharer.php?t=GitHub%20Copilot%20CLI%20for%20Beginners%3A%20Interactive%20v.%20non-interactive%20mode&u=https%3A%2F%2Fgithub.blog%2Fai-and-ml%2Fgithub-copilot%2Fgithub-copilot-cli-for-beginners-interactive-v-non-interactive-mode%2F)
- [](https://www.linkedin.com/shareArticle?title=GitHub%20Copilot%20CLI%20for%20Beginners%3A%20Interactive%20v.%20non-interactive%20mode&url=https%3A%2F%2Fgithub.blog%2Fai-and-ml%2Fgithub-copilot%2Fgithub-copilot-cli-for-beginners-interactive-v-non-interactive-mode%2F)
Welcome to GitHub Copilot CLI for Beginners! In this series (available in video and blog format), we’ll give you everything you need to get started using GitHub Copilot CLI, from your first prompt to tips for navigating the command line like a pro!
In this blog, we’ll cover the two main modes of the CLI: interactive and non-interactive. You’ll learn the differences between the two modes, how to enter them, and what they’re most useful for.
Let’s dive in!
What is GitHub Copilot CLI interactive mode?
Interactive mode is a back-and-forth, chat-like experience. When you launch Copilot CLI with Copilot, you’re already in interactive mode—that’s the default. Non-interactive mode is a separate option for when you want a quick, one-off answer without entering a session. (More on non-interactive mode later!)
In interactive mode, you can ask GitHub Copilot a question, review its response, and then either follow up with questions or another prompt—all within the same session. This is the mode for those who want to work hands-on with Copilot and iterate as you go.
Here’s how to enter interactive mode:
- From the command line, type `copilot` and hit Enter.
- Copilot may ask you to trust this folder, because it needs permission to read and modify files.
- Ask Copilot a question, like “How do I run this project locally?”
- Copilot will give you instructions, which you can do on your own. But if you want to work collaboratively, you can ask Copilot: “Can you run it for me?”
- Copilot will analyze your project and then start the server.
- We can review our project, decide what changes we want, and continue working with Copilot, all in the same session.
What is GitHub Copilot CLI non-interactive mode?
On the other hand, non-interactive mode is designed for speed and simplicity. Instead of having to enter a full session, you pass a single prompt right in the command line and get a response almost immediately, without needing to follow up with Copilot.
Designed as an in-line experience, this mode is perfect for quick, one-shot prompts like summarizing a repository, generating code snippets, or plugging Copilot into automated workflows, without leaving your shell context. Once you get an answer, you’re right back in your terminal flow.
Here’s how to enter non-interactive mode:
- Start at the regular command line (if you’re in Copilot, you’ll need to exit).
- Type `copilot -p` and prompt the agent with something like “Quickly summarize what this repository does and the key folders.”
- Copilot will sift through your project files to provide an answer. Ta-da! ✨
Together, these two modes help you tackle all kinds of projects efficiently: interactive for explorative, deeper work, and non-interactive for fast, focused results when you already know exactly what you need.
How to resume a previous Copilot session
Sometimes, you may want to pick up right where you left off in a previous Copilot session, while retaining all the context from that conversation.
If you’re in interactive mode, you can type `/resume` into the command line and Copilot will let you choose a previous session from a list. If you want to launch directly into the previous session picker from non-interactive mode, use `copilot --resume`.
It only takes one command to pick back up with Copilot, which is super useful if you already know what session you want to work in.
Take this with you GitHub Copilot CLI interactive and non-interactive modes are the fastest ways to prompt Copilot directly from your terminal. Having the option to pick between back-and-forth coding and quick prompting means you can work with Copilot, the way you want.
Keep an eye out for more videos in the GitHub Copilot CLI for Beginners series, where we’ll explore:
- Copilot CLI slash commands
- Using MCP servers with Copilot CLI
- And more!
Happy coding!
**Looking to try GitHub Copilot CLI?**Read the Docs and get started today.
More resources to explore:
- GitHub Copilot CLI for Beginners video series
- GitHub Copilot CLI for Beginners: Getting started with GitHub Copilot CLI
- GitHub Copilot CLI 101: how to use GitHub Copilot from the command line
- Best practices for GitHub Copilot CLI
- * *
Tags:
Written by
[Kayla Cinnamon](https://github.blog/author/cinnamonmsft/)
Senior AI Developer Tools Advocate
Table of Contents
- What is GitHub Copilot CLI interactive mode?
- What is GitHub Copilot CLI non-interactive mode?
- How to resume a previous Copilot session
More on [GitHub Copilot CLI](https://github.blog/tag/github-copilot-cli/)
[Building an emoji list generator with the GitHub Copilot CLI](https://github.blog/ai-and-ml/github-copilot/building-an-emoji-list-generator-with-the-github-copilot-cli/)
See how we created an emoji list generator during the Rubber Duck Thursday stream.
[Cassidy Williams](https://github.blog/author/cassidoo/ "Posts by Cassidy Williams")
[Build a personal organization command center with GitHub Copilot CLI](https://github.blog/ai-and-ml/github-copilot/build-a-personal-organization-command-center-with-github-copilot-cli/)
Learn about the productivity tool one GitHub engineer built, and how AI supported the development process.
[Cassidy Williams](https://github.blog/author/cassidoo/ "Posts by Cassidy Williams")&[Jacklyn Carroll](https://github.blog/author/jacklynlee31/ "Posts by Jacklyn Carroll")
Related posts

[Building an emoji list generator with the GitHub Copilot CLI](https://github.blog/ai-and-ml/github-copilot/building-an-emoji-list-generator-with-the-github-copilot-cli/)
See how we created an emoji list generator during the Rubber Duck Thursday stream.
[Cassidy Williams](https://github.blog/author/cassidoo/ "Posts by Cassidy Williams")

[Build a personal organization command center with GitHub Copilot CLI](https://github.blog/ai-and-ml/github-copilot/build-a-personal-organization-command-center-with-github-copilot-cli/)
Learn about the productivity tool one GitHub engineer built, and how AI supported the development process.
[Cassidy Williams](https://github.blog/author/cassidoo/ "Posts by Cassidy Williams")&[Jacklyn Carroll](https://github.blog/author/jacklynlee31/ "Posts by Jacklyn Carroll")

[Hack the AI agent: Build agentic AI security skills with the GitHub Secure Code Game](https://github.blog/security/hack-the-ai-agent-build-agentic-ai-security-skills-with-the-github-secure-code-game/)
Learn to find and exploit real-world agentic AI vulnerabilities through five progressive challenges in this free, open source game that over 10,000 developers have already used to sharpen their security skills.
[Joseph Katsioloudes](https://github.blog/author/jkcso/ "Posts by Joseph Katsioloudes")
Explore more from GitHub
Docs
Everything you need to master GitHub, all in one place.
GitHub
Build what’s next on GitHub, the place for anyone from anywhere to build anything.
Customer stories
Meet the companies and engineering teams that build with GitHub.
The GitHub Podcast
Catch up on the GitHub podcast, a show dedicated to the topics, trends, stories and culture in and around the open source developer community on GitHub.
We do newsletters, too
Discover tips, technical guides, and best practices in our biweekly newsletter just for devs.
Your email address
*Your email address
Subscribe
- [x] Yes please, I’d like GitHub and affiliates to use my information for personalized communications, targeted advertising and campaign effectiveness. See the GitHub Privacy Statement for more details.
Subscribe
Site-wide Links
[](https://github.com/)
Product
Platform
Support
Company
- GitHub on LinkedIn
- GitHub on Instagram
- GitHub on YouTube
- GitHub on X
- GitHub on TikTok
- GitHub on Twitch
- GitHub’s organization on GitHub
!Image 22×
问问这篇内容
回答仅基于本篇材料Skill 包
领域模板,一键产出结构化笔记论文精读包
把一篇论文 / 技术博客精读成结构化笔记:问题、方法、实验、批判、延伸阅读。
- · TL;DR(1 段)
- · 研究问题与动机
- · 方法概览
投融资雷达包
把一条融资 / 创投新闻整理成投资人视角的雷达卡:交易要点、判断、竞争格局、风险、尽调清单。
- · 交易要点(公司 / 轮次 / 金额 / 投资人 / 估值,材料未明示则写 “未披露”)
- · 投资 thesis(这家公司为什么值得关注)
- · 竞争格局与替代方案