Publish a new repository

Our discussion of Github fundamentals began with the assumption that you have a remote repository on the Github cloud. But where did the remote repository come from?

An arrow pointing to the remote repository asking where it came from.

In most cases, you will need to create a new repository on your computer and publish it. Publishing creates the repository on the cloud that you can use to back up and share your work.

An arrow pointing from a new repository on the local computer to a remote repository on the cloud. The arrow is labeled 'publish'.

In the next few exercises, we will learn how to create and publish a new repository.


Public vs. Private

When you publish a repository on Github, you have the option to set it as a public or private repository. A public repository can be viewed by anyone on Github, while a private repository is only visible to you and invited collaborators. If your project contains sensitive information, you’ll probably want to use a private repository. Otherwise, I encourage you to make your repositories public for several reasons:

1. Ease of access

Public repositories make it easier for collaborators to find and access your work.

2. Scientific transparency

Public repositories support transparency and reproducibility, key tenets of scientific research. By making your code public, you ensure it is available for other researchers trying to reproduce or build on your work.

3. Promotes better coding

It can be intimidating to think of other people being able to see your code. However, I find that this usually improves my code. When I think other people might actually want to use my work, I spend more time commenting and documenting the various features. I also tend to avoid shortcuts that might break the code further down the road. In the long run, this makes the code better and saves a significant amount of time.

4. Greater control over a project

When your code is in a public repository, collaborators can suggest modifications, but these changes require your approval before they can go into effect. By contrast, changes to a private repository do not require your approval. Consequently, a collaborator could potentially alter (or break!) your code without notifying you. So a public repository can be preferable if you want to retain control over your version of the code.


New vocabulary

PreviousNext