Introduction
This tutorial will show you how to upload a group of files to a GitHub repository.
Uploading your files to a GitHub repository lets you:
- Apply version control when you make edits to the files, so your project's history is protected and manageable.
- Back up your work.
- Pin the repository to your personal profile, so that others can see your work.
- Share and discuss your work with others, either publicly or privately.
If you're already familiar with Git, and you're looking for information on how to upload a locally-stored Git repository to GitHub, see Adding locally hosted code to GitHub.
Prerequisites
- You must have a GitHub account.
- You should have a group of files you'd like to upload.
Step 1: Create a new repository for your project
It's a good idea to create a new repository for each individual project you're working on. If you're writing a software project, grouping all the related files in a new repository makes it easier to maintain and manage the codebase over time.
-
In the upper-right corner of any page, select , then click New repository.
-
In the "Repository name" box, type a name for your project. For example, type "my-first-project."
-
In the "Description" box, type a short description. For example, type "This is my first project on GitHub."
-
Select whether your repository will be Public or Private. Select "Public" if you want others to be able to see your project.
-
Select Add a README file. You will edit this file in a later step.
-
Click Create repository.
Step 2: Upload files to your project's repository
So far, you should only see one file listed in the repository, the README.md
file you created when you initialized the repository. Now, we'll upload some of your own files.
- To the right of the page, select the Add file dropdown menu.
- From the dropdown menu, click Upload files.
- On your computer, open the folder containing your work, then drag and drop all files and folders into the browser.
- At the bottom of the page, under "Commit changes", select "Commit directly to the
main
branch, then click Commit changes.
Step 3: Edit the README file for your project's repository
Your repository's README file is typically the first item someone will see when visiting your repository. It usually contains information on what your project is about and why your project is useful.
As we learned in the Hello World tutorial, the README file (README.md
) is written in Markdown syntax. Markdown is an easy-to-read, easy-to-write language for formatting plain text.
In this step, we'll edit your project's README.md
using Markdown so that it includes some basic information about your project.
-
From the list of files, click
README.md
to view the file. -
In the upper right corner of the file view, click to open the file editor.
- You will see that some information about your project has been pre-filled for you. For example, you should see the repository name and repository description you completed in Step 1 displayed on line 1 and line 2.
-
Delete the existing text apart from
#
, then type a proper title for your project.- Example:
# About my first project on GitHub
.
- Example:
-
Next, add some information about your project, such as a description of the project's purpose or its main features.
Note
If you're not sure what to write, take a look at other repositories on GitHub Enterprise Server to see how other people describe their projects.
To apply more sophisticated formatting, such as adding images, links, and footnotes, see Basic writing and formatting syntax.
-
Above the new content, click Preview changes.
-
Take a look at how the file will render once we save our changes, then toggle back to "Edit".
-
Continue to edit and preview the text until you're happy with the content of your README.
-
In the top right, click Commit changes.
-
In the dialog box that opens, a commit message has been pre-filled for you ("Update README.md") and, by default, the option to "Commit directly to the
main
branch" has been selected. Leave these options as they are and go ahead and click Commit changes.
Conclusion
You have now created a new repository, uploaded some files to it, and added a project README.
As you add, edit or delete files directly in the browser on GitHub, GitHub will track these changes ("commits"), so you can start to manage your project's history and evolution.
When making changes, remember that you can create a new branch from the main
branch of your repository, so that you can experiment without affecting the main copy of files. Then, when you're happy with a set of a changes, open a pull request to merge the changes into your main
branch. For a reminder of how to do this, see Hello World.
Next steps
-
Most people want to keep working on their files locally (i.e. on their own computer), and then continually sync these locally-made changes with this "remote" repository on GitHub Enterprise Server. There are plenty of tools that let you do this, such as GitHub Desktop. To get started, you'd need to:
- Install GitHub Desktop. For more information, see Getting started with GitHub Desktop.
- Clone the remote repository, so you have a copy of it on your own computer. For more information, see Cloning and forking repositories from GitHub Desktop.
- Continually sync your local changes with this remote repository. For more information, see Syncing your branch in GitHub Desktop.
-
To learn more about other tools available for working with repositories hosted on GitHub Enterprise Server, see Connecting to GitHub.