Как скачать репозиторий с github windows

#статьи


  • 0

Закройте IDE. Забудьте про пуши. Отрекитесь от коммитов и репозиториев.

Кадр: сериал «Остановись и гори»

Максим Сафронов

Автор, редактор, IT-журналист. Рассказывает о новых технологиях, цифровых профессиях и полезных инструментах для разработчиков. Любит играть на электрогитаре и программировать на Swift.

Если вы откроете файл в веб-версии GitHub, то заметите, что там нет отдельной кнопки «Скачать». Действительно, удобного способа загружать код напрямую с сайта разработчики не завезли, но есть альтернативные способы — в этой статье как раз о них поговорим. Заодно разберёмся, как скачивать файлы с GitHub на смартфон — пока только на Android-устройства, с айфонами всё сложно.


Все проекты на GitHub хранятся в репозиториях. Репозиторий — это место, где лежат файлы, библиотеки и фрагменты кода программы. Хорошая новость: если у вас есть доступ к проекту, его можно утащить себе на компьютер и разобрать на отдельные файлы. Вот как это сделать:

Шаг 1. Выберите проект, который хотите скачать. Ваши репозитории хранятся в разделе Your repositories, а проекты из свободного доступа можно найти с помощью окошка Search or jump to.

Скриншот: Skillbox Media

Шаг 2. Откройте выбранный проект. Мы, например, решили забрать себе классический «виндовый» калькулятор, с недавних пор выложенный в открытый доступ в аккаунте Microsoft.

Скриншот: Skillbox Media

Шаг 3. Нажмите кнопку Code в правом верхнем углу. Выпадет меню, в котором нужно выбрать Download ZIP.

Скриншот: Skillbox Media

Готово! Теперь у нас на компьютере есть собственная версия проекта. Можно запустить его в Visual Studio, а также в другом редакторе кода или IDE и допилить под свои нужды. Например, перекрасить кнопки в фиолетовый цвет — а почему бы и нет? 🙂


Единственный штатный способ скачать отдельный файл в GitHub — это кнопка Raw. Она превращает код файла в обычный текстовый документ без всякой разметки — в таком виде его можно легко загрузить на жёсткий диск. Не слишком удобный, но рабочий способ — давайте его тоже разберём.

Шаг 1. В репозитории проекта откройте файл, который хотите скачать.

Скриншот: Skillbox Media

Шаг 2. Когда файл откроется, нажмите кнопку Raw.

Скриншот: Skillbox Media

Шаг 3. Перед вами — исходный код файла, открытый в браузере. Чтобы его скачать, нажмите правой кнопкой мыши, а потом выберите «Сохранить как…».

Скриншот: Skillbox Media

Шаг 4. В открывшемся окне можно задать файлу имя и формат. Если планируете работать с кодом в текстовом редакторе, можно оставить .txt.


Использовать расширение

В интернет-магазинах браузеров полно расширений, которые облегчают загрузку с GitHub. Например, GitZip for GitHub помогает скачивать не только файлы, но и целые папки. Рассказываем, как им пользоваться:

Шаг 1. Скачайте и установите утилиту в магазине расширений вашего браузера — есть версии для Chrome, Microsoft Edge и Mozilla.

Скриншот: Skillbox Media

На заметку: если расширение доступно для Chrome, то запустить его можно в любом браузере, работающем на хромовском движке Blink, — например, в Opera, Vivaldi или «Яндекс.Браузере».

Шаг 2. В репозитории проекта напротив каждого файла появятся чекбоксы — отметьте галочками те, которые хотите скачать.

Шаг 3. Нажмите на кнопку загрузки в правом нижнем углу.

Скриншот: Skillbox Media

Готово! Можно наслаждаться новыми возможностями до боли знакомого сервиса.

По умолчанию в мобильной версии GitHub нет функции скачивания файлов. Но её можно активировать, если открыть в мобильном браузере версию сайта для ПК. После этого можно будет скачать отдельный файл либо весь проект в виде ZIP-архива.

Если нужен проект целиком:

Шаг 1. Откройте веб-страницу нужного репозитория через Google Chrome.

Шаг 2. В контекстном меню браузера нажмите на кнопку «Версия для ПК».

Шаг 3. После этого страница перезагрузится и откроется обычная десктопная версия сайта. Нажмите зелёную кнопку Code, а потом — Download ZIP.

Скриншот: Skillbox Media

Если нужен отдельный файл:

Шаг 1. Откройте на GitHub страницу файла и активируйте версию для ПК.

Шаг 2. Когда откроется десктопная версия страницы, нажмите кнопку Raw в правом верхнем углу.

Шаг 3. Снова вызовите контекстное меню браузера и нажмите на значок загрузки в самом верху — после этого на смартфон скачается нужный файл в формате .txt.

Скриншот: Skillbox Media

К сожалению, на iOS десктопная версия GitHub не открывается ни в одном браузере, поэтому функции Raw и Download ZIP недоступны. Если у вас есть рабочий способ — напишите нам в редакцию, добавим его в статью.

В этой статье мы обсудили нюансы работы только с веб-версией GitHub. Если хотите полностью перенести проект на свой компьютер и работать с ним локально, почитайте нашу статью про GitHub Desktop. Вы узнаете, как создать репозиторий, синхронизировать его с ПК и обновлять файлы удалённо.

Ещё можно почитать материал про систему контроля версий Git. Объясняем на понятных схемах, как работает технология, которая лежит в основе GitHub и других похожих сервисов. Вы поймёте, как там всё устроено, и сможете блеснуть знаниями на собеседовании.

Жизнь можно сделать лучше!
Освойте востребованную профессию, зарабатывайте больше и получайте от работы удовольствие. А мы поможем с трудоустройством и важными для работодателей навыками.

Посмотреть курсы

Git clone illustration

The git clone command is used to create a copy of a specific repository or branch within a repository.

Git is a distributed version control system. Maximize the advantages of a full repository on your own machine by cloning.

What Does git clone Do?

git clone https://github.com/github/training-kit.git

When you clone a repository, you don’t get one file, like you may in other centralized version control systems. By cloning with Git, you get the entire repository — all files, all branches, and all commits.

Cloning a repository is typically only done once, at the beginning of your interaction with a project. Once a repository already exists on a remote, like on GitHub, then you would clone that repository so you could interact with it locally. Once you have cloned a repository, you won’t need to clone it again to do regular development.

The ability to work with the entire repository means that all developers can work more freely. Without being limited by which files you can work on, you can work on a feature branch to make changes safely. Then, you can:

  • later use git push to share your branch with the remote repository
  • open a pull request to compare the changes with your collaborators
  • test and deploy as needed from the branch
  • merge into the main branch.

How to Use git clone

Common usages and options for git clone

  • git clone [url]: Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits.
  • git clone --mirror: Clone a repository but without the ability to edit any of the files. This includes the refs, or branches. You may want to use this if you are trying to create a secondary copy of a repository on a separate remote and you want to match all of the branches. This may occur during configuration using a new remote for your Git hosting, or when using Git during automated testing.
  • git clone --single-branch: Clone only a single branch
  • git clone --sparse: Instead of populating the working directory with all of the files in the current commit recursively, only populate the files present in the root directory. This could help with performance when cloning large repositories with many directories and sub-directories.
  • `git clone —recurse-submodules[=<pathspec]: After the clone is created, initialize and clone submodules within based on the provided pathspec. This may be a good option if you are cloning a repository that you know to have submodules, and you will be working with those submodules as dependencies in your local development.

You can see all of the many options with git clone in git-scm’s documentation.

Examples of git clone

git clone [url]

The most common usage of cloning is to simply clone a repository. This is only done once, when you begin working on a project, and would follow the syntax of git clone [url].

git clone A Branch

git clone --single-branch: By default, git clone will create remote tracking branches for all of the branches currently present in the remote which is being cloned. The only local branch that is created is the default branch.

But, maybe for some reason you would like to only get a remote tracking branch for one specific branch, or clone one branch which isn’t the default branch. Both of these things happen when you use --single-branch with git clone.

This will create a clone that only has commits included in the current line of history. This means no other branches will be cloned. You can specify a certain branch to clone, but the default branch, usually main, will be selected by default.

To clone one specific branch, use:

git clone [url] --branch [branch] --single-branch

Cloning only one branch does not add any benefits unless the repository is very large and contains binary files that slow down the performance of the repository. The recommended solution is to optimize the performance of the repository before relying on single branch cloning strategies.

git clone With SSH

Depending on how you authenticate with the remote server, you may choose to clone using SSH.

If you choose to clone with SSH, you would use a specific SSH path for the repository instead of a URL. Typically, developers are authenticated with SSH from the machine level. This means that you would probably clone with HTTPS or with SSH — not a mix of both for your repositories.

Related Terms

  • git branch: This shows the existing branches in your local repository. You can also use git branch [banch-name] to create a branch from your current location, or git branch --all to see all branches, both the local ones on your machine, and the remote tracking branches stored from the last git pull or git fetch from the remote.
  • git pull: Updates your current local working branch with all new commits from the corresponding remote branch on GitHub. git pull is a combination of git fetch and git merge.
  • git push: Uploads all local branch commits to the remote.
  • git remote -v: Show the associated remote repositories and their stored name, like origin.

Contribute to this article on GitHub.

Get started with git and GitHub

Review code, manage projects, and build software alongside 40 million developers.

Sign up for GitHub

Sign in

Since you have wiped out your computer and want to checkout your project again, you could start by doing the below initial settings:

git config --global user.name "Your Name"
git config --global user.email [email protected]

Login to your github account, go to the repository you want to clone, and copy the URL under «Clone with HTTPS».

You can clone the remote repository by using HTTPS, even if you had setup SSH the last time:

git clone https://github.com/username/repo-name.git

NOTE:

If you had setup SSH for your remote repository previously, you will have to add that key to the known hosts ssh file on your PC; if you don’t and try to do git clone [email protected]:username/repo-name.git, you will see an error similar to the one below:

Cloning into 'repo-name'...
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXDoJWGl7E1IGOCspZomTxdCARLviMw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Using HTTPS is a easier than SSH in this case.

GitHub is one of the largest developer resources, and an absolute must-know for aspiring web developers to explore and share projects online.

person using a computer do download from github

If you’re just starting out with git and GitHub, taking open-source code from GitHub to experiment with or add to your own projects is one great way to learn or develop your own apps. You can even connect your GitHub repository to your preferred hosting to deploy and test your apps. To do that, you’ll need to learn the basics: getting a file from GitHub onto your computer.

Download Now: 50 Code Templates [Free Snippets]

In this post, we’ll show you how to download different resources from GitHub. We’ll cover:

  • downloading a file
  • downloading a repository
  • downloading a release
  • downloading multiple files

Let’s get started.

To download a single file from GitHub, follow these steps:

1. Navigate to the GitHub repository page that contains the file. If it’s a public repository, you can visit the page without logging in. If it’s a private repository, you’ll need to log in and have the proper permissions to access it.

2. From the main repository page, locate the file you want to download. You can do this by navigating the folders, or by clicking Go to File near the top of the page. This opens a list of all files in the repository that you can search.

file search in github

3. Click the file you want to download. This will open the file in GitHub.

4. On the file page, click the Raw button. This opens the raw code in your browser.

the raw code view in github

5. Right-click the page and select Save as…, then name the file and choose where to save it on your device.

How to Download a GitHub Repository

GitHub is made up of repositories. A repository is a place where all files in a project can be stored, accessed, tracked, and modified. To download a repository, follow these steps:

1. Navigate to the GitHub repository page. If it’s a public repository, you can visit the page without logging in. If it’s a private repository, you’ll need to log in and have the proper permissions to access it.

2. On the main repository page, click the green Code button.

the main github page with the code button circled

3. In the menu that appears, click Download ZIP. The entire repository will be downloaded to your device as a zipped file.

the github download zip button

With that, you should be able to open the file locally.

How to Download a Release From GitHub

Repositories may also put out releases, which are packaged versions of the project. To download a release:

1. Navigate to the GitHub repository page. If it’s a public repository, you can visit the page without logging in. If it’s a private repository, you’ll need to log in and have the proper permissions to access it.

2. Click Releases, located on the right-side panel.

the releases option int he github side panel

3. You’ll be brought to a page listing releases from newest to oldest. Under the release that you want to download, locate the Assets section. Click a file under this section to download it.

assets in the github releases menu

You’ll be able to open this zipped file on your local device.

How to Download Multiple Files From GitHub

Unless you want to download an entire repository or release, there’s currently no way to bulk-download multiple files from GitHub. Depending on how many files you need from a repository, it may be best to download each individual file you need, or download the entire repository/release and delete the files you don’t need.

Get files from GitHub.

There’s a lot to learn when it comes to using GitHub — the platform packs a ton of features, and it can seem intimidating to newcomers. However, GitHub does an excellent job of making its tools simple and accessible. Case in point: downloading a single file or an entire repository is possible with just a few clicks.

New Call-to-action

GitHub has one of the largest collection of repositories in the world. From small websites to big complex software, everything is here. To get the code on your local there is no direct method you have to clone the repository to your local machine. There are 2 ways how you could do this first one is using Command-line and the other one is using the command-line. For beginners, I would suggest you use GitHub Desktop as this method is simple to use and you won’t get stuck in it.

Using Command-line

To clone a repository using Command-Line you have to first install git version control then only you will be able to clone the repo.

1.On Github, navigate to the repository page which you want to clone/download.
2.Above the list of files, you will see a green button click Code.
image

3.To clone the repository using HTTPS, under “Clone with HTTPS”, click. To clone/download the repository using an SSH key, including a certificate issued by your organization’s SSH certificate authority, click Use SSH, then click. To clone a repository using GitHub CLI, click Use GitHub CLI, then click.
image

4.The clipboard icon for copying the URL to clone a repository

5.Open Terminal
6.Change the current working directory to the location where you want the cloned directory.
7.Type git clone, and then paste the URL you copied earlier.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

Enter fullscreen mode

Exit fullscreen mode

8.Press Enter to create your local clone.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.

Enter fullscreen mode

Exit fullscreen mode

Method 2 – Using GitHub Desktop

1.Go to GitHub.com, navigate to the main page of the repository.

2.Above all the code you will find a Code button in green colour click it to open a small tab.
«Code» button
image

3.Click on GitHub desktop to clone and open the repository with GitHub Desktop.
«Open with GitHub Desktop» button
image

4.Follow the prompts in GitHub Desktop to complete the clone.

Conclusion

With this, you will have a folder created on your local machine with git initiated in it. Now any changes that you make in that folder can be committed easily to GitHub again.

In this document we took a deep look at git clone. The most important takeaways are:

  1. git clone is used to create a copy of a target repo
  2. The target repo can be local or remote
  3. Git supports a few network protocols to connect to remote repos
  4. There are many different configuration options available that change the content of the clone

If you face any problem with the above steps, just comment below. Read my blogs at sanjaysinghrajpoot.me

  • Как скачать проигрыватель windows media для windows 11
  • Как скачать стим для windows 10
  • Как скачать презентацию на флешку с ноутбука windows
  • Как скачать эквалайзер для windows 10
  • Как скачать фотографии с iphone на компьютер windows