PDF download Download Article
Import a repository on GitHub with this easy guide
PDF download Download Article

GitHub's personal repositories are essentially storage spaces for project files. You can import a repository on GitHub by using an old project URL and the GitHub Importer; you can also use the command line to import old repositories.

Things You Should Know

  • Open your GitHub project page and click the "+" button.
  • Click "Import Repository" and enter your repository's URL.
  • Open the "Git Shell" application and enter the cloning command using your repository's URL.
Method 1
Method 1 of 3:

Using GitHub Importer

PDF download Download Article
  1. To use the Importer, you'll first need the URL of your desired repository.
  2. This should be in the upper right-hand or left-hand corner of your screen; clicking it will prompt a drop-down menu.
    Advertisement
  3. This will take you to the import menu.
  4. You'll need to do this in the field under the "Your old repository's clone URL" heading. [1]
  5. These include the user account with which the repository is associated and a name for the repository.
  6. Public repositories are available to the entire GitHub community, whereas Private repositories are restricted to you and any collaborators with whom you choose to share.
  7. This should be in the lower right-hand corner of the Import menu.
    • You may have to enter the account credentials associated with your repository if it's being imported from an account with password-protected attributes.
    • In the event that you have multiple projects saved at the target URL, click your desired file name to import that repository.
  8. If you are importing numerous files, you can choose to include or exclude large files from within the repository. Click "Continue" to finalize this process.
    • Importing large files can cost extra, so review your payment plan if you're uncertain about the implications of importing large files.
  9. GitHub will send you an email at your registered address when the process is complete.
  10. Advertisement
Method 2
Method 2 of 3:

Using the Command Line

PDF download Download Article
  1. If you want to import an old repository from a private network, you'll want to use a command line to do so.
    • You'll need to have your old repository's URL and your GitHub username available before continuing.
  2. You can do this from within the "+" menu in the upper right- or left-hand corner of your project window.
  3. This will allow you to type commands into GitHub in order to perform certain actions; to use Git Shell, you will need to have GitHub installed on your computer.
  4. The command should say "git clone --bare [external Git URL][external user account]/[target repository name].git", excluding the quotation marks and brackets. Fill in the bracketed information with your own pertinent information. [2]
  5. This command should say "cd *[repository name].git*", followed by "git push --mirror https://github.com/ [GitHub user account]/[target repository name].git" on a separate line. Exclude the quotation marks and brackets, and fill in the bracketed information with your own pertinent information.
  6. This command should say "cd ..", followed by "rm -rf [target repository name].git" on a separate line. Exclude the quotation marks and brackets, and fill in the bracketed information with your own pertinent information.
  7. If your old repository's files are now in your new repository, your import was successful!
  8. Advertisement
Method 3
Method 3 of 3:

Creating a New Repository

PDF download Download Article
  1. If you're importing using the command line or you're just trying to start a project from scratch, you'll need to start a new repository.
  2. This should be in the upper right-hand or left-hand corner of your screen; clicking it will prompt a drop-down menu.
  3. This will take you to the repository options. [3]
  4. This is in the top left corner of the repository options menu; you'll need to select the account on which you wish to save the repository.
  5. The name will help differentiate the repository from others like it, and the description will help other users determine whether or not the repository is relevant to them.
  6. Public repositories are available to the entire GitHub community, whereas Private repositories are restricted to you and any collaborators with whom you choose to share.
    EXPERT TIP

    Kevin Burnett

    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Kevin Burnett
    Software Developer

    GitHub recognizes structure. GitHub works best with some structure, so don't leave folders empty when first creating them. Add at least a readme or placeholder file so GitHub recognizes it as a proper directory. Pushing up a standalone empty folder may fail.

  7. Start-up options include the following:
    • A README file, which describes the contents and purpose of the repository.
    • A .gitignore file, which tells the repository which files to ignore when uploading the repository's contents to GitHub. [4]
    • A software license, which will allow others to freely use and benefit from your repository's contents. [5]
  8. This is at the bottom of the repository options menu.
  9. This will set up your repository for you in the desktop location of your choosing. You have successfully created a repository! [6]
  10. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    How do I create a new folder in a GitHub repository?
    Kevin Burnett
    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Software Developer
    Expert Answer
    Creating folders in the GitHub repository is very similar to creating files in a Git repository, so basically, when you have the GitHub repository cloned locally on your computer, you can just add a folder on your computer within that directory. Then you can add it using the git add command and subsequently commit and push it back up. The only caveat is that you can't actually add a folder to GitHub unless there are a lot of files inside of it. So when you do create that folder, just make sure you add at least one file inside of it, and then it works exactly like adding a file.
  • Question
    How can I clone a private GitHub Repository?
    Kevin Burnett
    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Software Developer
    Expert Answer
    You have to make sure that you have an SSH connection; it links your computer and the private repository that you're typing to. You can create an SSH key on your computer using a public key from the repository on your GitHub profile. From there, you'll be able to clone using the SSH URL. That's how GitHub checks to make sure that you're someone who's allowed to do that because it's linked to your GitHub account.
Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      Advertisement

      Expert Interview

      Thanks for reading our article! If you’d like to learn more about computer programming, check out our in-depth interview with Kevin Burnett .

      About This Article

      Thanks to all authors for creating a page that has been read 71,452 times.

      Is this article up to date?

      Advertisement