Sharing software is vital to allow multiple people to collaborate on the same codebase. For open-source software, sharing code also gives the public access to the code for reviewing, testing, and contributing. When papers and software are both published, it increases the reproducibility and reusability of scientific work. Sharing code in a public online repository also allows others to cite the software and credit its authors.
Tutorials for sharing code with GitHub