Getting started with your GitHub account

With a user account on GitHub, you can import or create repositories, collaborate with others, and connect with the GitHub community.

This guide will walk you through setting up your GitHub account and getting started with GitHub's features for collaboration and community.

Part 1: Configuring your GitHub account

The first steps in starting with GitHub are to create an account, choose a product that fits your needs best, verify your email, set up two-factor authentication, and view your profile.

There are several types of accounts on GitHub. Every person who uses GitHub has their own user account, which can be part of multiple organizations and teams. Your user account is your identity on GitHub and represents you as an individual.

1. 创建帐户

To sign up for a GitHub account, navigate to https://github.com/ and follow the prompts.

To keep your GitHub account secure you should use a strong and unique password. 更多信息请参阅“创建强式密码”。

2. Choosing your GitHub product

You can choose GitHub Free or GitHub Pro to get access to different features for your personal account. You can upgrade at any time if you are unsure at first which product you want.

For more information on all of GitHub's plans, see "GitHub's products."

3. 验证电子邮件地址

To ensure you can use all the features in your GitHub plan, verify your email address after signing up for a new account. 更多信息请参阅“验证电子邮件地址”。

4. Configuring two-factor authentication

双重身份验证(或 2FA)是登录网站或应用时使用的额外保护层。 We strongly urge you to configure 2FA for the safety of your account. 更多信息请参阅“关于双重身份验证”。

5. Viewing your GitHub profile and contribution graph

Your GitHub profile tells people the story of your work through the repositories and gists you've pinned, the organization memberships you've chosen to publicize, the contributions you've made, and the projects you've created. For more information, see "About your profile" and "Viewing contributions on your profile."

Part 2: Using GitHub's tools and processes

To best use GitHub, you'll need to set up Git. Git 负责在您计算机上本地发生的、与 GitHub 有关的所有内容。 To effectively collaborate on GitHub, you'll write in issues and pull requests using GitHub Flavored Markdown.

1. Learning Git

GitHub's collaborative approach to development depends on publishing commits from your local repository to GitHub for other people to view, fetch, and update using Git. For more information about Git, see the "Git Handbook" guide. For more information about how Git is used on GitHub, see "GitHub flow."

2. 设置 Git

If you plan to use Git locally on your computer, whether through the command line, an IDE or text editor, you will need to install and set up Git. 更多信息请参阅“设置 Git”。

If you prefer to use a visual interface, you can download and use GitHub Desktop. GitHub Desktop comes packaged with Git, so there is no need to install Git separately. 更多信息请参阅“开始使用 GitHub Desktop”。

Once you install Git, you can connect to GitHub repositories from your local computer, whether your own repository or another user's fork. 从 Git 连接到 GitHub 仓库时,您将需要使用 HTTPS 或 SSH 通过 GitHub 进行身份验证。 更多信息请参阅“关于远程仓库”。

3. Choosing how to interact with GitHub

Everyone has their own unique workflow for interacting with GitHub; the interfaces and methods you use depend on your preference and what works best for your needs.

For more information about how to authenticate to GitHub with each of these methods, see "About authentication to GitHub."

方法描述Use cases
Browse to GitHub.comIf you don't need to work with files locally, GitHub lets you complete most Git-related actions directly in the browser, from creating and forking repositories to editing files and opening pull requests.This method is useful if you want a visual interface and need to do quick, simple changes that don't require working locally.
GitHub DesktopGitHub Desktop 可扩展并简化您的 GitHub.com 工作流程,它使用可视界面,而不是在命令行上使用命令文本。 For more information on getting started with GitHub Desktop, see "Getting started with GitHub Desktop."This method is best if you need or want to work with files locally, but prefer using a visual interface to use Git and interact with GitHub.
IDE or text editorYou can set a default text editor, like Atom or Visual Studio Code to open and edit your files with Git, use extensions, and view the project structure. For more information, see "Associating text editors with Git."This is convenient if you are working with more complex files and projects and want everything in one place, since text editors or IDEs often allow you to directly access the command line in the editor.
Command line, with or without GitHub CLIFor the most granular control and customization of how you use Git and interact with GitHub, you can use the command line. For more information on using Git commands, see "Git cheatsheet."

GitHub CLI is a separate command-line tool you can install that brings pull requests, issues, GitHub Actions, and other GitHub features to your terminal, so you can do all your work in one place. For more information, see "GitHub CLI."
This is most convenient if you are already working from the command line, allowing you to avoid switching context, or if you are more comfortable using the command line.
GitHub APIGitHub has a REST API and GraphQL API that you can use to interact with GitHub. For more information, see "Getting started with the API."The GitHub API would be most helpful if you wanted to automate common tasks, back up your data, or create integrations that extend GitHub.

4. Writing on GitHub

To make your communication clear and organized in issues and pull requests, you can use GitHub Flavored Markdown for formatting, which combines an easy-to-read, easy-to-write syntax with some custom functionality. 更多信息请参阅“关于 GitHub 上的书写和格式化”。

You can learn GitHub Flavored Markdown with the "Communicating using Markdown" course on GitHub Learning Lab.

5. Searching on GitHub

Our integrated search allows you to find what you are looking for among the many repositories, users and lines of code on GitHub. You can search globally across all of GitHub or limit your search to a particular repository or organization. For more information about the types of searches you can do on GitHub, see "About searching on GitHub."

Our search syntax allows you to construct queries using qualifiers to specify what you want to search for. For more information on the search syntax to use in search, see "Searching on GitHub."

6. Managing files on GitHub

With GitHub, you can create, edit, move and delete files in your repository or any repository you have write access to. You can also track the history of changes in a file line by line. For more information, see "Managing files on GitHub."

Part 3: Collaborating on GitHub

Any number of people can work together in repositories across GitHub. You can configure settings, create project boards, and manage your notifications to encourage effective collaboration.

1. Working with repositories

创建仓库

仓库就像项目的文件夹。 You can have any number of public and private repositories in your user account. Repositories can contain folders and files, images, videos, spreadsheets, and data sets, as well as the revision history for all files in the repository. 更多信息请参阅“关于仓库”。

When you create a new repository, you should initialize the repository with a README file to let people know about your project. 更多信息请参阅“创建新仓库”。

克隆仓库

You can clone an existing repository from GitHub to your local computer, making it easier to add or remove files, fix merge conflicts, or make complex commits. 克隆仓库将提取 GitHub 在当时拥有的所有仓库数据的完整副本,包括项目每个文件和文件夹的所有版本。 更多信息请参阅“克隆仓库”。

复刻仓库

A fork is a copy of a repository that you manage, where any changes you make will not affect the original repository unless you submit a pull request to the project owner. 复刻最常见的用法是对其他人的项目提出更改或将其他人的项目用作自己创意的起点。 更多信息请参阅“使用复刻”。

2. 导入项目

If you have existing projects you'd like to move over to GitHub you can import projects using the GitHub Importer, the command line, or external migration tools. For more information, see "Importing source code to GitHub."

3. Managing collaborators and permissions

您可以使用仓库议题、拉取请求及项目板与其他人协作处理您的项目。 You can invite other people to your repository as collaborators from the Collaborators tab in the repository settings. 更多信息请参阅“邀请协作者参加个人仓库”。

You are the owner of any repository you create in your user account and have full control of the repository. Collaborators have write access to your repository, limiting what they have permission to do. 更多信息请参阅“用户帐户仓库的权限级别”。

4. 管理仓库设置

As the owner of a repository you can configure several settings, including the repository's visibility, topics, and social media preview. 更多信息请参阅“管理仓库设置”。

5. 设置项目的健康贡献

To encourage collaborators in your repository, you need a community that encourages people to use, contribute to, and evangelize your project. For more information, see "Building Welcoming Communities" in the Open Source Guides.

By adding files like contributing guidelines, a code of conduct, and a license to your repository you can create an environment where it's easier for collaborators to make meaningful, useful contributions. 更多信息请参阅“设置健康参与的项目”。

6. Using GitHub Issues and project boards

You can use GitHub Issues to organize your work with issues and pull requests and manage your workflow with project boards. For more information, see "About issues" and "About project boards."

7. Managing notifications

Notifications provide updates about the activity on GitHub you've subscribed to or participated in. 如果您的某项对话不再感兴趣,您可以取消订阅、取消关注或自定义以后接收的通知类型。 更多信息请参阅“关于通知”。

8. 使用 GitHub Pages

You can use GitHub Pages to create and host a website directly from a GitHub repository. For more information, see "About GitHub Pages."

9. 使用 GitHub Discussions

You can enable GitHub Discussions for your repository to help build a community around your project. Maintainers, contributors and visitors can use discussions to share announcements, ask and answer questions, and participate in conversations around goals. 更多信息请参阅“关于讨论”。

Part 4: Customizing and automating your work on GitHub

You can use tools from the GitHub Marketplace, the GitHub API, and existing GitHub features to customize and automate your work.

1. Using GitHub Marketplace

GitHub Marketplace contains integrations that add functionality and improve your workflow. 在 GitHub Marketplace 中,您可以发现、浏览和安装免费及付费工具,包括 GitHub 应用程序、OAuth 应用程序 和 GitHub Actions。 更多信息请参阅“关于 GitHub Marketplace”。

2. Using the GitHub API

There are two versions of the GitHub API: the REST API and the GraphQL API. You can use the GitHub APIs to automate common tasks, back up your data, or create integrations that extend GitHub. For more information, see "About GitHub's APIs."

3. Building GitHub Actions

With GitHub Actions, you can automate and customize GitHub's development workflow on GitHub. 您可以创建自己的操作,以及使用和自定义 GitHub 社区分享的操作。 更多信息请参阅“Learn GitHub Actions”。

4. Publishing and managing GitHub Packages

GitHub Packages 是一种软件包托管服务,允许您私下或公开托管软件包,并将包用作项目中的依赖项。 For more information, see “Introduction to GitHub Packages."

Part 5: Building securely on GitHub

GitHub has a variety of security features that help keep code and secrets secure in repositories. Some features are available for all repositories, while others are only available for public repositories and repositories with a GitHub Advanced Security license. For an overview of GitHub security features, see "GitHub security features."

1. 保护您的仓库

As a repository administrator, you can secure your repositories by configuring repository security settings. These include managing access to your repository, setting a security policy, and managing dependencies. For public repositories, and for private repositories owned by organizations where GitHub Advanced Security is enabled, you can also configure code and secret scanning to automatically identify vulnerabilities and ensure tokens and keys are not exposed.

For more information on steps you can take to secure your repositories, see "Securing your repository."

2. Managing your dependencies

A large part of building securely is maintaining your project's dependencies to ensure that all packages and applications you depend on are updated and secure. You can manage your repository's dependencies on GitHub by exploring the dependency graph for your repository, using Dependabot to automatically raise pull requests to keep your dependencies up-to-date, and receiving Dependabot alerts and security updates for vulnerable dependencies.

For more information, see "Securing your software supply chain."

Part 6: Participating in GitHub's community

There are many ways to participate in the GitHub community. You can contribute to open source projects, interact with people in the GitHub Community Support, or learn with GitHub Learning Lab.

1. Contributing to open source projects

Contributing to open source projects on GitHub can be a rewarding way to learn, teach, and build experience in just about any skill you can imagine. For more information, see “How to Contribute to Open Source" in the Open Source Guides.

You can find personalized recommendations for projects and good first issues based on your past contributions, stars, and other activities in Explore. For more information, see “Finding ways to contribute to open source on GitHub."

2. Interacting with GitHub Community Support

You can connect with developers around the world in GitHub Community Support to ask and answer questions, learn, and interact directly with GitHub staff.

3. Learning with GitHub Learning Lab

You can learn new skills by completing fun, realistic projects in your very own GitHub repository with GitHub Learning Lab. Each course is a hands-on lesson created by the GitHub community and taught by the friendly Learning Lab bot.

For more information, see “Git and GitHub learning resources."

4. Supporting the open source community

GitHub 赞助者 allows you to make a monthly recurring payment to a developer or organization who designs, creates, or maintains open source projects you depend on. For more information, see “About GitHub 赞助者."

5. 联系 GitHub 支持

GitHub 支持 可帮助您排除在使用 GitHub 时遇到的问题。 For more information, see “About GitHub 支持."

延伸阅读

此文档对您有帮助吗?

隐私政策

帮助我们创建出色的文档!

所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。

做出贡献

或, 了解如何参与。