Download Article
Import a repository on GitHub with this easy guide
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.
Steps
-
Open your GitHub project page. To use the Importer, you'll first need the URL of your desired repository.
-
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
-
Click the "Import Repository" option. This will take you to the import menu.
-
Enter your repository's URL. You'll need to do this in the field under the "Your old repository's clone URL" heading. [1] X Research source
-
Set up your repository's tags. These include the user account with which the repository is associated and a name for the repository.
-
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.
-
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.
-
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.
-
Wait for your import to finish. GitHub will send you an email at your registered address when the process is complete.
Advertisement
-
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.
-
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.
-
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.
-
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] X Research source
-
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.
-
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.
-
Review your local repository. If your old repository's files are now in your new repository, your import was successful!
Advertisement
-
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.
-
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.
-
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.
-
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.
-
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.EXPERT TIPSoftware DeveloperKevin 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.
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.
-
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] X Research source
- A software license, which will allow others to freely use and benefit from your repository's contents. [5] X Research source
-
Click "Create Repository". This is at the bottom of the repository options menu.
-
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] X Research source
Advertisement
Expert Q&A
Search
-
QuestionHow do I create a new folder in a GitHub repository?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.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.
-
QuestionHow can I clone a private GitHub Repository?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.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
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
- Repositories are the equivalent of a folder on your computer.Thanks
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
- Be sure to save your work often to avoid losing progress.Thanks
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 .
References
- ↑ https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/importing-a-repository-with-github-importer
- ↑ https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/importing-a-git-repository-using-the-command-line
- ↑ https://help.github.com/articles/creating-a-new-repository/
- ↑ https://help.github.com/articles/ignoring-files/
- ↑ https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository
- ↑ http://blog.udacity.com/2015/06/a-beginners-git-github-tutorial.html
About This Article
Thanks to all authors for creating a page that has been read 71,084 times.
Advertisement