Skip to Main Content

Depositing Data in Repositories: GitHub

How to submit to GitHub

Unlike many of the other site in this guide, GitHub is less of a repository than a collaboration platform. As a result, there are fewer guidelines for submission; you won't have to ensure your files are formatted in a particular way, or wait for a review period to pass before your data goes public. This makes submission much simpler, but also means that adhering to optional best practices and agreeing on standards with your collaborators is particularly important. 

To create a repository and upload files, you will first have to create a GitHub account. Once you are logged in, there are two different ways to create a repository in GitHub. For most situations, creating a new repository from the Web UI will be the easiest option, but assess the steps for both options below and determine what might be best for your project. Remember that it is best practice to start a new repository for each project you begin on GitHub, to avoid files from different projects getting confused. 

The language on this page has largely been pulled from the GitHub documentation pages, and has been lightly edited for clarity and specificity to MSK.

Creating a new repository from the web UI

  1. In the upper-right corner of any page, select +, then click New repository. 

  1. You can choose to create a repository from an existing template by hitting “Choose a template” from the dropdown menu and then selecting a template repository 

  • If you choose to use a template, select “Include all branches” to include the directory structure and files from all branches in the template 

  • If you're not using a template, there are a number of optional items you can pre-populate your repository with. If you're importing an existing repository to GitHub, don't choose any of these options, as you may introduce a merge conflict. You can add or create new files using the user interface or choose to add new files using the command line later 

  1. Use the Owner dropdown menu to select the account you want to own the repository. 

  1. Give your repository a title, which should reflect the nature of your project, and an optional description with basic information about your code 

  1. Choose a repository visibility 

  1. Follow best practices for code sharing 

  • Create a README file 

  • Create a .gitignore file 

  • Select a software license to determine your project’s terms of reuse 

  1. Click Create repository. 

Creating a new repository from an URL query

You can use query parameters to pre-fill form fields when creating a new repository. Query parameters are optional parts of a URL you can customize to share a specific web page view, such as search filter results or an issue template on GitHub. To specify values for the predefined query parameters, you must match the key and value pair.

Pre-filling form fields with a URL query may be useful if you often want to create repositories with the same default settings. For example, a PI may want each researcher in their lab to create a repository for code they develop for the lab with the same name, description and visibility. Using a URL query, the PI can create a link that pre-fills the repository name, description and visibility fields and share it with the whole lab.

You must have the proper permissions for any action to use the equivalent query parameter. For example, you must have permission to create a repository in an organization to specify the organization as the repository owner in a query parameter. For more information, see Repository roles for an organization.

If you create an invalid URL using query parameters, or if you don’t have the proper permissions, the invalid query parameters will be ignored and the rest of the URL will function as normal. If you create a URL that exceeds the server limit, the URL will return a 414 URI Too Long error page.

General best practices for GitHub repositories

GitHub suggests the following steps to ensure your repository will be clear and easy to use for your collaborators (as well as any future re-users of your code). Keep in mind these suggestions are only a stepping off point - communicating with your collaborators about shared standards and procedures will help avoid confusion when uploading files, pulling requests, and making changes. 

  • Create a README file.
    • README files include brief overviews of important information about the repository they are attached to, helping to easily communicate expectations for your project and manage contributions. Typically, a README will have the following: 
      • What the project does
      • Why the project is useful
      • How users can get started with the project
      • Where users can get help with your project
      • Who maintains and contributes to the project
  • Secure your repository
  • Favor branching over forking
  • Use Git Large File Storage if necessary