Skip to Content
《使用 Git 进行版本控制》第三版
book

《使用 Git 进行版本控制》第三版

by Prem Kumar Ponuthorai, Jon Loeliger
May 2025
Beginner to intermediate
548 pages
7h 40m
Chinese
O'Reilly Media, Inc.
Content preview from 《使用 Git 进行版本控制》第三版

第 18 章 Git 和 GitHub Git 和 GitHub

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

自 2005 年 Git 诞生以来,我们见证了 基于 Git 的工具社区的成长。如今,这些工具已经多达数百种,形式也多种多样,从桌面GUI到流行集成开发环境中的 Git 扩展。但在许多开发者甚至是非开发者的心目中,有一个工具格外引人注目:GitHub

很多人认为 GitHub 的出现是 ,我们中的很多人现在都认为工作是在社会化编码的概念下进行的。这种工作理念最初应用于开源企业,但多年来我们看到,即使在封闭源代码企业中,这种将代码作为地理分布协作点的理念也在不断发展。如今,这种趋势已经导致开发人员通过内源方式维护和构建软件的转变,这也就不足为奇了。

在本章中,我们将重点讨论 GitHub 如何利用原生 Git 功能,主要是在该平台上托管仓库时应注意的事项。首先,我们将概述 GitHub 作为个人和企业账户托管平台的情况。然后,我们详细介绍 GitHub 如何融入 Git 生态系统。接下来,我们将深入探讨如何在 GitHub 中使用仓库、浏览其可用功能,以及如何应用简单的分支策略和解决合并冲突。在总结本章之前,我们将简要讨论扩展和集成 GitHub 平台的可用方法,以及如何使用 GitHub 实践现代软件开发。

接下来,让我们看看 GitHub 能提供什么。

关于 GitHub

简而言之,GitHub 是一个 Git 托管平台。 它被认为是最受欢迎的平台之一,具有丰富的功能,促进了协作编码、自动化和 CI/CD、安全、项目管理、团队管理等学科的发展,并提供了一套客户端应用程序。这些功能促进了开发者社区的建立,他们在该平台上开发和发布软件产品,无论是个人使用还是企业使用。

在撰写本文时,GitHub 拥有 8 300 多万开发者、400 多万组织和 2 亿多个存储库,约 90% 的财富 100 强企业都在使用 GitHub,使其成为全球最大、最先进的开发平台(图 18-1)。

vcg3 1801
图 18-1. GitHub 主页

GitHub 账户类型

要开始使用 GitHub,首先需要在平台上创建一个 账户。您的 GitHub.com 个人账户是您在平台上的身份标识,代表着您的个人身份。拥有活跃账户后,您就可以对平台上存储的代码进行协作。它还能让您组织和控制对 GitHub 上存储的代码或仓库的访问。

您可以在 GitHub 上创建三种类型的账户:

个人账户

每个人的个人账户 都有一个用户名和个人资料。图 18-2显示了一个用户配置文件示例。有了活跃的个人账户,你就可以拥有仓库、GitHub 软件包和项目。您在平台上的任何操作都将归属于您的个人账户。

vcg3 1802
图 18-2. 八爪猫账户简介

个人账户有两种类型:GitHub 免费账户和 GitHub 专业账户。这两种类型的账户都不限制所拥有的公共或私有仓库数量。它们还允许在账户所拥有的仓库中无限量地使用合作者。这两种类型的区别在于,使用 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

学习 GitHub Actions

学习 GitHub Actions

Brent Laster
《Kubernetes 最佳实践》第二版

《Kubernetes 最佳实践》第二版

Brendan Burns, Eddie Villalba, Dave Strebel, Lachlan Evenson
GraphQL 学习指南

GraphQL 学习指南

Eve Porcello, Alex Banks

Publisher Resources

ISBN: 9798341657922