X
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.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 55,415 times.
Learn more...
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.
Steps
Method 1
Method 1 of 3:
Using GitHub Importer
-
1Open your GitHub project page. To use the Importer, you'll first need the URL of your desired repository.
-
2Click 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
-
3Click the "Import Repository" option. This will take you to the import menu.
-
4Enter your repository's URL. You'll need to do this in the field under the "Your old repository's clone URL" heading.[1]
-
5Set up your repository's tags. These include the user account with which the repository is associated and a name for the repository.
-
6Click "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.
-
7Click "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.
-
8Choose "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.
-
9Wait for your import to finish. GitHub will send you an email at your registered address when the process is complete.
Advertisement
Method 2
Method 2 of 3:
Using the Command Line
-
1Open 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.
-
2Create a new GitHub repository. You can do this from within the "+" menu in the upper right- or left-hand corner of your project window.
-
3Open 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.
-
4Enter 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]
-
5Push 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.
-
6Remove 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.
-
7Review your local repository. If your old repository's files are now in your new repository, your import was successful!
Advertisement
Method 3
Method 3 of 3:
Creating a New Repository
-
1Open 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.
-
2Click 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.
-
3Click "New Repository". This will take you to the repository options.[3]
-
4Click 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.
-
5Type 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.
-
6Click "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.
-
7Add 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]
-
8Click "Create Repository". This is at the bottom of the repository options menu.
-
9Click "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]
Advertisement
Warnings
- Be sure to save your work often to avoid losing progress.⧼thumbs_response⧽
Advertisement
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
Advertisement