How to clone repo to github

How to clone repo to github

Cloning a repository from GitHub to GitHub Desktop

You can use GitHub to clone remote repositories to GitHub Desktop.

Tip: You also can use GitHub Desktop to clone repositories that exist on GitHub. For more information, see «Cloning a repository from GitHub Desktop.»

Sign in to GitHub.com and GitHub Desktop before you start to clone.

On GitHub.com, navigate to the main page of the repository.

Above the list of files, click

Open with GitHub Desktop to clone and open the repository with GitHub Desktop. How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Note: If the repository is configured to use LFS, you will be prompted to initialize Git LFS.

Sign in to GitHub.com and GitHub Desktop before you start to clone.

On GitHub.com, navigate to the main page of the repository.

Above the list of files, click

Open with GitHub Desktop to clone and open the repository with GitHub Desktop. How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Note: If the repository is configured to use LFS, you will be prompted to initialize Git LFS.

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Contributing to projects

In this article

Learn how to contribute to a project through forking.

After using GitHub by yourself for a while, you may find yourself wanting to contribute to someone else’s project. Or maybe you’d like to use someone’s project as the starting point for your own. This process is known as forking.

Creating a «fork» is producing a personal copy of someone else’s project. Forks act as a sort of bridge between the original repository and your personal copy. You can submit pull requests to help make other people’s projects better by offering your changes up to the original project. Forking is at the core of social coding at GitHub. For more information, see «Fork a repo.»

Forking a repository

This tutorial uses the Spoon-Knife project, a test repository that’s hosted on GitHub.com that lets you test the fork and pull request workflow.

Note: If you want to copy additional branches from the parent repository, you can do so from the Branches page. For more information, see «Creating and deleting branches within your repository.»

You’ve successfully forked the Spoon-Knife repository, but so far, it only exists on GitHub. To be able to work on the project, you will need to clone it to your computer.

You can clone your fork with the command line, GitHub CLI, or GitHub Desktop.

On GitHub, navigate to your fork of the Spoon-Knife repository.

Above the list of files, click

Copy the URL for the repository.

. How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Change the current working directory to the location where you want the cloned directory.

Press Enter. Your local clone will be created.

To learn more about GitHub CLI, see «About GitHub CLI.»

In the File menu, click Clone Repository.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Click the tab that corresponds to the location of the repository you want to clone. You can also click URL to manually enter the repository location.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Choose the repository you want to clone from the list.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Click Choose. and navigate to a local path where you want to clone the repository.

Click Clone.

Making and pushing changes

Go ahead and make a few changes to the project using your favorite text editor, like Visual Studio Code. You could, for example, change the text in index.html to add your GitHub username.

For more information about how to stage and commit changes in GitHub Desktop, see «Committing and reviewing changes to your project.»

When you stage and commit files, you essentially tell Git, «Okay, take a snapshot of my changes!» You can continue to make more changes, and take more commit snapshots.

Right now, your changes only exist locally. When you’re ready to push your changes up to GitHub, push your changes to the remote.

For more information about how to push changes in GitHub Desktop, see «Pushing changes to GitHub.»

Making a pull request

At last, you’re ready to propose changes into the main project! This is the final step in producing a fork of someone else’s project, and arguably the most important. If you’ve made a change that you feel would benefit the community as a whole, you should definitely consider contributing back.

GitHub will bring you to a page that shows the differences between your fork and the octocat/Spoon-Knife repository. Click Create pull request.

GitHub will bring you to a page where you can enter a title and a description of your changes. It’s important to provide as much useful information and a rationale for why you’re making this pull request in the first place. The project owner needs to be able to determine whether your change is as useful to everyone as you think it is. Finally, click Create pull request.

Pull Requests are an area for discussion. In this case, the Octocat is very busy, and probably won’t merge your changes. For other projects, don’t be offended if the project owner rejects your pull request, or asks for more information on why it’s been made. It may even be that the project owner chooses not to merge your pull request, and that’s totally okay. Your copy will exist in infamy on the Internet. And who knows—maybe someone you’ve never met will find your changes much more valuable than the original project.

You’ve successfully forked and contributed back to a repository. Go forth, and contribute some more! For more information, see «Finding ways to contribute to open source on GitHub.»

Fork a repo

In this article

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

Most commonly, forks are used to either propose changes to someone else’s project to which you do not have write access, or to use someone else’s project as a starting point for your own idea. You can fork a repository to create a copy of the repository and make changes without affecting the upstream repository. For more information, see «Working with forks.»

Propose changes to someone else’s project

For example, you can use forks to propose changes related to fixing a bug. Rather than logging an issue for a bug you have found, you can:

Use someone else’s project as a starting point for your own idea.

Open source software is based on the idea that by sharing code, we can make better, more reliable software. For more information, see the «About the Open Source Initiative» on the Open Source Initiative.

For more information about applying open source principles to your organization’s development work on GitHub.com, see GitHub’s white paper «An introduction to innersource.»

When creating your public repository from a fork of someone’s project, make sure to include a license file that determines how you want your project to be shared with others. For more information, see «Choose an open source license» at choosealicense.com.

For more information on open source, specifically how to create and grow an open source project, we’ve created Open Source Guides that will help you foster a healthy open source community by recommending best practices for creating and maintaining repositories for your open source project. You can also take a free GitHub Skills course on maintaining open source communities.

If you have not yet, you should first set up Git. Don’t forget to set up authentication to GitHub.com from Git as well.

Forking a repository

You might fork a project to propose changes to the upstream, or original, repository. In this case, it’s good practice to regularly sync your fork with the upstream repository. To do this, you’ll need to use Git on the command line. You can practice setting the upstream repository using the same octocat/Spoon-Knife repository you just forked.

Note: If you want to copy additional branches from the parent repository, you can do so from the Branches page. For more information, see «Creating and deleting branches within your repository.»

To learn more about GitHub CLI, see «About GitHub CLI.»

To create a fork of a repository, use the gh repo fork subcommand.

Cloning your forked repository

Right now, you have a fork of the Spoon-Knife repository, but you do not have the files in that repository locally on your computer.

On GitHub.com, navigate to your fork of the Spoon-Knife repository.

Above the list of files, click

Copy the URL for the repository.

. How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Change the current working directory to the location where you want the cloned directory.

Press Enter. Your local clone will be created.

To learn more about GitHub CLI, see «About GitHub CLI.»

In the File menu, click Clone Repository.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Click the tab that corresponds to the location of the repository you want to clone. You can also click URL to manually enter the repository location.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Choose the repository you want to clone from the list.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Click Choose. and navigate to a local path where you want to clone the repository.

Click Clone.

Configuring Git to sync your fork with the original repository

When you fork a project in order to propose changes to the original repository, you can configure Git to pull changes from the original, or upstream, repository into the local clone of your fork.

On GitHub.com, navigate to the octocat/Spoon-Knife repository.

Above the list of files, click

Copy the URL for the repository.

. How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

Change directories to the location of the fork you cloned.

Now, you can keep your fork synced with the upstream repository with a few Git commands. For more information, see «Syncing a fork.»

To learn more about GitHub CLI, see «About GitHub CLI.»

You can make any changes to a fork, including:

Find another repository to fork

Fork a repository to start contributing to a project. If you have access to a private repository and the owner permits forking, you can fork the repository to your personal account, or an organization on GitHub Team where you have repository creation permissions. You cannot fork a private repository to an organization using GitHub Free. For more information, see «GitHub’s products.»

You can browse Explore to find projects and start contributing to open source repositories. For more information, see «Finding ways to contribute to open source on GitHub.»

You have now forked a repository, practiced cloning your fork, and configured an upstream repository.

For more information about cloning the fork and syncing the changes in a forked repository from your computer, see «Set up Git.»

You can also create a new repository where you can put all your projects and share the code on GitHub. Creating a repository for your project allows you to store code in GitHub. This provides a backup of your work that you can choose to share with other developers. For more information, see “Create a repository.»»

Each repository on GitHub is owned by a person or an organization. You can interact with the people, repositories, and organizations by connecting and following them on GitHub. For more information, see «Be social.»

GitHub has a great support community where you can ask for help and talk to people from around the world. Join the conversation on GitHub Community.

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Clone repository into GitHub

I have been using git locally for while a now and have a private repository with complete change history etc. I now want to share this on GitHub, so I need to clone from my local repo into a new GitHub repo. I cannot find any way to do this. How can I get all my history up onto GitHub?

3 Answers 3

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

You don’t need to «clone onto GitHub». You just have to create a repository on GitHub and push your changes there:

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github

And from that point, your history in the master branch are in GitHub’s master branch.

You do this by pushing to remote repo on GitHub. You should get the whole history and everything.

Not the answer you’re looking for? Browse other questions tagged git github git-clone or ask your own question.

Linked

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Earth Data Analytics Online Certificate

Intro to earth data science textbook
intro-to-earth-data-science-textbook Home

Lesson 2. Copy (Fork) and Download (Clone) GitHub Repositories

After completing this page, you will be able to:

About Git and GitHub

Previously in this textbook, you learned that git is tool that is used to track changes in files (a process called version control) through a suite of commands that you can execute in the Terminal. You also learned that GitHub allows you to store files in the cloud to access them from any computer and to share them with others.

You can use git and GitHub together in a workflow to make changes to files locally with git and to store and share your files on GitHub.com. To work together, git and GitHub use repositories (i.e. directories of files) to manage and store files.

Data Tip: A GitHub repository is a directory of files and folders that is hosted on GitHub.com.

Having a copy of a set of files stored in GitHub repositories in the cloud is ideal because:

Directory Structure of Repositories

A typical repository (e.g. project-name ) is structured as follows:

URL of Repositories on GitHub.com

When a repository is stored on GitHub.com, it is assigned a unique URL (i.e. link on the GitHub.com website) that can be used to find the repository and access its files. While repositories on GitHub.com can be made either public or private, the default is public for free GitHub accounts.

In either case (public or private), the URL links to a GitHub repository always follows the same format:

Create a Copy of Other Users’ Files on GitHub.com (Fork a Repo)

Using GitHub.com, you can make a copy of a GitHub repository (also known as a repo) owned by another user or organization (a task referred to as forking a repository). This means that you do not have to fork a repository that you already own. Instead, other users can fork your repository if they would like a copy to work with, and your original files will not be modified!

The ability to fork a repository is a benefit of using GitHub repositories because the forked repository is linked to the original. This means that you (or other users) can update the files in your fork from the original to your (or their) forked repository. It also means that you can suggest changes to the original repository, which can be reviewed by the owner of that repository. Thus, forking allows you to collaborate with others while protecting the original versions of files. When collaborating, everyone will work with copies of the original files. And all changes are tracked in each file’s history and can be undone at any time.

You can fork an existing GitHub repository from the main GitHub.com page of the repository that you want to copy.

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github To fork a repo, first navigate to the repo you want to fork. Then click the **fork** button in the upper right hand corner of your screen. You can then create a copy of of this repo in your account.

Later in this textbook, you will learn how to suggest changes to the original repository, receive updates from the original repository to your fork, and collaborate with others.

Copy Files From GitHub.com to Your Computer ( git clone )

To work locally with a GitHub repository (including forked repos), you need to create a local copy of that repository on your computer (a task referred to as cloning a repo). You can clone GitHub repositories that you own or that are owned by others (e.g. repositories that you have forked to your GitHub account).

In either case, cloning allows you to create a local copy of a GitHub repository, so that you can work with the files locally on your computer. Cloning a repository to your computer is a great way to work on your files locally, while still having a copy of your files on the cloud on GitHub.com. Following the steps below, you will use the git clone command in the terminal to clone GitHub repositories.

Use Bash to Change to Your Desired Working Directory

For this textbook, you will clone a repo into a directory called earth-analytics on your computer (or wherever you are working. This earth-analytics directory should be located in the home directory of your computer.

Copy a Github.com Repository URL From GitHub.com

To run the git clone command, you need the URL for the repository that you want to clone (i.e. either a repository owned by you or a fork that you created of another user’s repository).

How to clone repo to github. Смотреть фото How to clone repo to github. Смотреть картинку How to clone repo to github. Картинка про How to clone repo to github. Фото How to clone repo to github You can make a local copy of your forked repository on your computer with the git clone command.

Data Tip: You can also copy the URL directly from your web browser, or in some cases, you might already know the URL. However, in many cases, you will come across a new GitHub.com repository on your own and will need to follow these instructions to copy the URL for future use.

Run the Git Clone Command in the Terminal

Now that you have the URL for a repository that you want to copy locally, you can use the terminal to run the git clone command followed by the URL that you copied:

You have now made a local copy of a repository under your earth-analytics directory. You can double check that the directory exists using the ls command in the terminal.

Go to GitHub.com and login. Then use the link below to open the practice-git-skillz repo.

To make sure you did things right, in bash, cd to the practice-git-skillz directory on your computer. Type:

The paths returned should look something like this:

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *