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.

Method 1
Method 1 of 3:

Using GitHub Importer

  1. 1
    Open your GitHub project page. To use the Importer, you'll first need the URL of your desired repository.
  2. 2
    Click the "+" button. 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. 3
    Click the "Import Repository" option. This will take you to the import menu.
  4. 4
    Enter your repository's URL. You'll need to do this in the field under the "Your old repository's clone URL" heading.[1]
  5. 5
    Set up your repository's tags. These include the user account with which the repository is associated and a name for the repository.
  6. 6
    Click "Public" or "Private" to categorize your repository. 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. 7
    Click "Begin Import". 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. 8
    Choose "Include large files" if necessary. 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. 9
    Wait for your import to finish. 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

  1. 1
    Open your GitHub project page. 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. 2
    Create a new GitHub repository. You can do this from within the "+" menu in the upper right- or left-hand corner of your project window.
  3. 3
    Open the "Git Shell" application. 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. 4
    Enter the command to clone your repository. 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. 5
    Push the repository to GitHub. 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. 6
    Remove your local repository's temporary files. 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. 7
    Review your local repository. 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

  1. 1
    Open your GitHub project page. 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. 2
    Click the "+" button. This should be in the upper right-hand or left-hand corner of your screen; clicking it will prompt a drop-down menu.
  3. 3
    Click "New Repository". This will take you to the repository options.[3]
  4. 4
    Click the account drop-down menu. 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. 5
    Type in a name and description for your repository. 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. 6
    Click "Public" or "Private" to categorize your repository. 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. 7
    Add optional items to your repository if you wish. 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. 8
    Click "Create Repository". This is at the bottom of the repository options menu.
  9. 9
    Click "Set up in Desktop". This will set up your repository for you in the desktop location of your choosing. You have successfully created a repository![6]
  10. Advertisement

Warnings

Advertisement

About This Article

wikiHow Staff
Co-authored by:
wikiHow Staff Writer
This article was co-authored by wikiHow Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. This article has been viewed 55,415 times.
How helpful is this?
Co-authors: 3
Updated: September 18, 2022
Views: 55,415
Categories: Programming
Advertisement