惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
月光博客
月光博客
T
Tailwind CSS Blog
小众软件
小众软件
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
B
Blog RSS Feed
博客园 - 司徒正美
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
博客园 - Franky
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research

The GitHub Blog

How to bring your software delivery workflow into GitHub with agent apps Your guide to GitHub Universe 2026 is here: The schedule just launched! What 50 open source projects taught us about security in the AI era GitHub availability report: July 2026 Write your first prompt with the GitHub Copilot app Your contributors are AI-first now. Is your project? From coder to orchestrator: How agents shift the role of a developer Using the GitHub Copilot SDK for Java A guide to slash commands in the GitHub Copilot app How we took malware advisories beyond npm How the GitHub legal team used Copilot CLI to streamline their workflows Turn one giant AI-generated pull request to a reviewable stack Don't stop early: Case-folding source code at memory speed Stacked sessions and pull requests in the GitHub Copilot app Tame Dependabot: Group your updates, slow the cadence, keep security fast Disrupting supply chain attacks on npm and GitHub Actions The harness is all you need (mostly) The harness is all you need (mostly) GitHub Copilot app for Beginners: Getting started The case for a cooldown: Why Dependabot now waits before issuing version updates Copilot vs. raw API access: What are you actually paying for? Next chapter: Restructuring GitHub's bug bounty program How to build interactive experiences with canvases $100 million for open source: A milestone built by the community The cost of saying yes has changed GitHub for Beginners: Your roadmap to mastering the GitHub essentials Better tools made Copilot code review worse. Here's how we actually improved it. How GitHub gave every repository a durable owner Automating cross-repo documentation with GitHub Agentic Workflows GitHub availability report: June 2026
GitHub for Beginners: Answers to some common questions
Natalie Guevara · 2026-06-09 · via The GitHub Blog

Welcome back to GitHub for Beginners. This is the final episode of the season, and we’ve covered a lot so far. Make sure to check out our other episodes to see all the various topics we’ve discussed.

Today, we’re going to spend some time answering some questions that people often have, especially when they’re first getting started. So without further ado, let’s jump right in.

As always, if you prefer to watch the video or want to reference it, we have all of our GitHub for Beginners episodes available on YouTube.

What is SSH and how do I add my SSH key to GitHub?

An SSH key is a secure shell key. It’s a pair of files on your computer that has two parts: a private key and a public key.

The private key stays on your computer and should never be shared. The public key is what you share with platforms like GitHub. When you store your public key on GitHub, git uses your private key to confirm your identity when you push and pull code. In order for you to be authenticated, your public key on GitHub needs to match the private key on your computer.

So how do you do this? Let’s create a key pair and add your public key to GitHub now.

(And remember, if you prefer a video walkthrough, that is available.)

  1. Open up a terminal and enter the following command. Remember to replace the email placeholder with your email address you use to log into GitHub.
ssh-keygen –t ed25519 – C YOUREMAIL@DOMAIN.COM
  1. When it prompts you to enter a file to save the key, press Enter to accept the default file and location.
  2. Enter a passphrase that you’ll remember. Note that the terminal will not display what you type, so be careful not to have any typos!
  3. Reenter your passphrase.

This will create your new SSH key. Now you want to add it to your ssh-agent. An ssh-agent is a program that securely stores your keys so that you don’t need to keep entering your passphrase.

To add this new SSH key to the ssh-agent, run the following command. Note that you will need to add your passphrase when prompted.

ssh-add ~/.ssh/id_ed25519

Now that you have created the SSH key and configured your ssh-agent, the next step is adding the public key to GitHub.

  1. In your terminal, run the following command.
cat ~/.ssh/id_ed25519.pub
  1. Copy the entire line that appears in the terminal as a response to that command.
  2. Open a browser and navigate to github.com.
  3. Click your profile picture in the top-right corner and select Settings.
  4. In the menu on the left-hand side, select SSH and GPG keys.
  5. On the right-hand side, click the green New SSH key button.
  6. Give the key that you’re about to add a name in the “Title” box that describes this key in a way you’ll remember. For example, if this is your work laptop you might enter a title of “work-laptop”.
  7. Paste the key you copied from the terminal into the “Key” box.
  8. Click the green Add SSH key button at the bottom of the window.

Congratulations! Your computer is now configured to connect to GitHub over SSH.

How do I add a PAT to GitHub? What is a PAT?

PAT stands for Personal Access Token. A PAT is a special credential that you create on GitHub for tools that need authentication. You control its permissions and can revoke it any time. On GitHub, you’ll commonly use a PAT to authenticate via command line or the GitHub API.

There are two types of PATs available: fine-grained tokens and classic tokens. First we’ll walk through creating a fine-grained PAT.

  1. Open a browser and navigate to github.com.
  2. Click your profile picture in the top-right corner and select Settings.
  3. Scroll to the bottom of the list of options in the left-hand column and select Developer settings.
  4. In the left-hand column, expand the option for Personal access tokens. Select Fine-grained tokens from the options displayed.
  5. Click the green Generate new token button in the center of the window.
  6. Enter a name and description for the token. This should make it clear what the token is going to be used for (e.g., a name of “cli-access” with a description of “access the Copilot CLI”).
  7. Under “Expiration,” select a date that matches how long you need the token to be valid. Once the token expires, it will not work anymore.
  8. Under “Repository access,” select which repositories you want the PAT to be able to access. You can limit the selection to only specific repositories if you know which repositories it will need to access.
  9. Under “Permissions”, click Add permissions to select which permissions you’re granting to this PAT. This lets you define the scope of what the PAT can do.
  10. For each permission, you can specify whether it has read-only access or read and write access.
  11. When you’re satisfied with the permissions, scroll to the bottom and click the green Generate token button.
  12. A window pops up, providing a review of all of the information associated with this token. Verify that the information is correct, and then click Generate token.
  13. GitHub will now show you the token. Make sure that you copy it and store it in a safe location (e.g., a password manager), because GitHub only shows you this token once.

Now let’s go through creating a classic token. As you’ll see, it’s very similar in several ways.

  1. Open a browser and navigate to github.com.
  2. Click your profile picture in the top-right corner and select Settings.
  3. Scroll to the bottom of the list of options in the left-hand column and select Developer settings.
  4. In the left-hand column, expand the option for Personal access tokens. Select Tokens (classic) from the options displayed.
  5. In the main window, click Generate new token and select Generate new token (classic).
  6. Give the token a clear name that explains what it will be used for (e.g., “terminal-access”).
  7. Under “Expiration,” select a date that matches how long you need the token to be valid. Once the token expires, it will not work anymore.
  8. Select the scopes for your token. The scopes indicate what access permissions the token grants.
  9. When you’re satisfied with the scopes, scroll to the bottom and click the green Generate token button.
  10. GitHub will now show you the token. Make sure that you copy it and store it in a safe location (e.g., a password manager), because GitHub only shows you this token once.

This creates the classic token. The next time that GitHub asks for your password in a terminal, instead of supplying your password, you could paste this token.

What’s the difference between merging and rebasing, and how do I fix a merge conflict?

A merge conflict is what happens when two changes touch the same part of a file, and git needs your help to decide what the final version should be. There are a few different ways you can resolve this, but we’re just going to walk through it using the GitHub UI.

  1. Open a pull request that has a merge conflict. GitHub will provide a message indicating that there’s a conflict and you won’t be able to automatically merge.
  2. Scroll to the bottom and click the Resolve conflicts button inside the warning about conflicts.
  3. GitHub opens the files that have conflicts. Use the editor to resolve the conflicts by choosing which version of the file to use in each case where there’s a conflict.
  4. Once the file has no more conflict markers (i.e., you’ve addressed every conflict), select Mark as resolved in the top-right.
  5. Repeat this process for every file that has merge conflicts.
  6. After you’ve addressed all the files that have conflicts, click the green Commit merge button at the top of the window.

This updates your pull request with the merged conflict and now you’ll be able to merge that change into your repository. Well done!

Now let’s talk about the difference between merging and rebasing, and when you might want to use one over another.

Merging combines changes from one branch into another by creating a new commit that ties both histories together. It preserves the history of both branches. You should merge when you want to preserve the full history of how work happened. This is commonly used for feature branches that are going to be merged into main, such as when you’re adding new functionality.

On the other hand, rebasing moves or replaces your branch’s commits on top of another branch. It rewrites the history to create a linear and cleaner commit timeline. You should rebase when you want a clean linear history, like when you are updating your feature branch to pull in the latest changes from main. For example, if you are working on a feature, but you want to pull in the latest changes from main before merging.

How do I undo my last commit?

Let’s say that you’re in a situation where you’ve already pushed your commit to your branch, and you want to undo it. You can undo your commit through the GitHub UI.

  1. Open the commit that you want to undo on github.com.
  2. Scroll to the bottom of the commit and select the Revert button.
  3. GitHub creates a new commit that undoes the changes from your previous commit. It’s important to realize that this doesn’t erase the commit history, but rather puts a new change in place that undoes your previous changes. You can now either merge this commit directly or open a pull request with it. Opening a pull request is the safest option when others might be using the branch.

If your changes are local, and you haven’t yet pushed to a branch, you can locally revert your commit by running the following command.

This removes the commit from your local repository, but keeps your work staged so that you don’t lose any changes. If you would rather undo your changes even locally to reset your workspace, you can use the following command. Just realize that by doing this, you might lose your work!

How do I update or sync a forked repository on GitHub?

Forking a repository creates your own copy of a project so that you can explore or make changes to it without affecting the original repository. This is especially important when you want to contribute to an open source project. Here’s how you can fork a repository.

  1. Open the repository that you want to fork on github.com.
  2. Select the Fork button at the top of the repository.
  3. Choose the Owner of this forked version, which in most cases will be your GitHub account.
  4. You may optionally rename the repository by providing a new Repository name. By default, forked repositories keep the names of the upstream repository.
  5. At the bottom of the window, select Create fork.
  6. This creates a full copy of the project under your account. To work on it locally, select the Code button and clone it to your machine.

Now that you’ve created the fork, you want to make sure that you still pull in the latest changes from the upstream repository. Otherwise, your forked copy can quickly become out of date.

  1. Navigate to the main page for your forked repository on github.com.
  2. At the top of the repository, select the Sync fork button.
  3. Select Update branch in the pop-up menu.

When you do this, GitHub automatically pulls in the latest changes from the upstream repository to keep your fork up to date. You can also do this from the command line.

  1. Open a terminal and navigate to your repository.
  2. Set the upstream repository. Make sure to update the URL in the following command with your original repository URL.
git remote add upstream YOUR_ORIGINAL_REPOSITORY_URL
  1. Pull in the latest changes.
  1. Merge the latest changes into your project. Note that the following command assumes that the upstream project uses main as the default branch. If it uses something else, you will need to use that branch in the following command.
  1. This updates your local copy with all of the changes to the upstream branch. So now, you need to push them to GitHub to make sure your repository is synchronized.

Now you know how to work in your own copy of a project and keep your work synchronized!

How do I review a pull request on GitHub?

A pull request (often abbreviated PR) is a place to share code and talk about changes. Here are three helpful practices to keep in mind when you’re reviewing a pull request.

  1. Start by understanding the goal of the pull request. Open the pull request and read the description. See if it has an associated issue, any screenshots, or notes from the author. Knowing the purpose helps you know why the changes exist and what you’re looking for.
  2. Review the code changes in small sections. Open the Files changed tab and move through the changes one group at a time. If something isn’t clear, leave a comment on that line. Ask questions, offer suggestions, or let the author know if you see a better approach. Keep your comments specific so they know exactly what you’re referencing. It might help to open the code on your machine either via the command line or in a codespace to run the code yourself to ensure you understand. Use terms like “nit” if your comment is not a necessary suggestion for merging the pull request.
  3. Highlight what’s going well. When you see code that’s well organized, thoughtful, or teaches you something, mention it! Positive feedback reinforces good patterns and helps teammates feel supported.

When everything looks ready, use the Submit review button to approve the changes or request updates.

Copilot code review can also help you understand pull requests and suggest improvements. Note that in order to use Copilot, your organization admin needs to enable Copilot for either your repository or your user account. Once Copilot is enabled, you don’t need to install anything special—Copilot code review will automatically appear as an option in pull requests.

  1. Open a pull request on github.com where you want to use Copilot code review.
  2. Select Reviewers in the top-right.
  3. Select Copilot from the list of suggested reviewers.

In a short amount of time, Copilot will complete its review. You can scroll down and see the comments left by Copilot. It always leaves a “Comment” type of review, not an “Approve” or “Request changes” type of review. This means that Copilot reviews do not count toward required approvals nor will they block merging changes.

Next steps

And that’s a wrap! With this episode, we’ve finished another season of GitHub for Beginners, ending with some of the most common questions we’ve seen or heard. We hope that you found this information helpful, and don’t forget to check out our full library of GitHub for Beginners topics.

Happy coding!

Written by

Kedasha Kerr

Kedasha is a Developer Advocate at GitHub where she enjoys sharing the lessons she's learned with the wider developer community. She finds joy in helping others learn about the tech industry and loves sharing her experience as a software developer. Find her online @itsthatladydev.

Explore more from GitHub

Docs

Docs

Everything you need to master GitHub, all in one place.

Go to Docs

GitHub

GitHub

Build what’s next on GitHub, the place for anyone from anywhere to build anything.

Start building

Customer stories

Customer stories

Meet the companies and engineering teams that build with GitHub.

Learn more

The GitHub Podcast

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.

Listen now