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.
Using GitHub Importer
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.
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.
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.
Using the Command Line
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.
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!
Creating a New Repository
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 “New Repository”.
This will take you to the repository options.
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.
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.
- A software license, which will allow others to freely use and benefit from your repository’s contents.
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!
Tips
- Repositories are the equivalent of a folder on your computer.
Warnings
- Be sure to save your work often to avoid losing progress.