How To Download A File From Github Using Terminal

When you create a repository on GitHub.com, it exists as a remote repository. You can clone your repository to create a local re-create on your reckoner and sync between the two locations.

About cloning a repository

You can clone a repository from GitHub.com to your local reckoner to brand information technology easier to ready merge conflicts, add or remove files, and button larger commits. When you lot clone a repository, you re-create the repository from GitHub.com to your local machine.

Cloning a repository pulls downwards a full copy of all the repository information that GitHub.com has at that betoken in fourth dimension, including all versions of every file and binder for the project. You lot tin push your changes to the remote repository on GitHub.com, or pull other people'southward changes from GitHub.com. For more data, meet "Using Git".

Yous tin clone your existing repository or clone another person's existing repository to contribute to a project.

Cloning a repository

  1. On GitHub.com, navigate to the master page of the repository.

  2. Higher up the list of files, click Code. "Code" button

  3. To clone the repository using HTTPS, under "Clone with HTTPS", click . To clone the repository using an SSH key, including a certificate issued by your organisation'southward SSH certificate authorization, click Use SSH, and so click . To clone a repository using GitHub CLI, click Utilize GitHub CLI, then click . The clipboard icon for copying the URL to clone a repository

    The clipboard icon for copying the URL to clone a repository with GitHub CLI

  4. Open up Terminal Terminal Git Bash.

  5. Change the electric current working directory to the location where yous want the cloned directory.

  6. Blazon git clone, then paste the URL you copied before.

                    $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY                              
  7. Printing 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 ten (delta 1), reused ten (delta one) > Unpacking objects: 100% (10/10), washed.              

To clone a repository locally, use the repo clone subcommand. Replace the repository parameter with the repository proper name. For example, octo-org/octo-repo, monalisa/octo-repo, or octo-repo. If the OWNER/ portion of the OWNER/REPO repository argument is omitted, it defaults to the name of the authenticating user.

            gh repo clone              repository                      

You lot tin also utilize the GitHub URL to clone a repository.

            gh repo clone              https://github.com/cli/cli                      
  1. On GitHub.com, navigate to the main page of the repository.
  2. In a higher place the list of files, click Code. "Code" button
  3. Click Open with GitHub Desktop to clone and open the repository with GitHub Desktop. "Open with GitHub Desktop" button
  4. Follow the prompts in GitHub Desktop to consummate the clone.

For more information, see "Cloning a repository from GitHub to GitHub Desktop."

Cloning an empty repository

An empty repository contains no files. Information technology's oft made if you don't initialize the repository with a README when creating it.

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

  2. To clone your repository using the command line using HTTPS, under "Quick setup", click . To clone the repository using an SSH key, including a certificate issued past your organization'due south SSH certificate authorisation, click SSH, then click . Empty repository clone URL button

    Alternatively, to clone your repository in Desktop, click Set upward in Desktop and follow the prompts to complete the clone. Empty repository clone desktop button

  3. Open Terminal Last Git Fustigate.

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

  5. Type git clone, and then paste the URL you copied before.

                  $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY                          
  6. 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: Full x (delta 1), reused 10 (delta ane) > Unpacking objects: 100% (10/x), done.            

Troubleshooting cloning errors

When cloning a repository it'due south possible that you lot might run into some errors.

If you're unable to clone a repository, check that:

  • You lot can connect using HTTPS. For more than data, run into "HTTPS cloning errors."
  • Yous have permission to admission the repository yous want to clone. For more information, see "Error: Repository not establish."
  • The default branch you desire to clone still exists. For more information, see "Error: Remote Head refers to nonexistent ref, unable to checkout."

Further reading

  • "Troubleshooting connectivity problems"

DOWNLOAD HERE

Posted by: browndong1983.blogspot.com