Friday, 17 August 2018

How to Publish Your Project at GitHub

It is important for modern software developers to publish open source projects online and collaborate with other developers over the whole world. Thanks to the modern technologies includes Git and its well-known service provider GitHub, these tasks become quite easy nowadays.

This guide outlines the whole process to publish a project on GitHub. Let's start.

How-to Guide

1. Install Git

Install and setup Git in your local computer:

2. Initial a Local Git Repository

Under your project directory, to initial a local git repository as follows:
$ git init

3. Manage Personal Information

If you choose to make your personal information public on GitHub, you can simply configure as follows:
$ git config --global user.name '<your-name>'
$ git config --global user.email '<your-email>'
If you want to keep your personal information private on GitHub, this is the way to do so:
  • sign in GitHub website, Edit profile > Personal settings > Emails, check the options "Keep my email address private" and "Block command line pushes that expose my email"
  • your GitHub non-reply email will be shown in that web page
  • config personal information for GitHub hosted repositories using your GitHub non-reply email:
  • $ git config user.name '<your-GitHub-login-name>'
    $ git config user.email '<your-GitHub-nonreply-email>'
    

4. Manage .gitignore

Under your project directory, create a file called .gitignore that lists all files/patterns which should NOT be managed/tracked by Git (in other word, to be ignored). The different sorts of projects determine the different ignore list. Please check the following examples for references:

5. Manage files

Add the project files to the local repository:
  1. add all project files (except the ignored files) into staging area
  2. $ git add .
  3. commit the staged files
  4. $ git commit -m '<commit message>'

6. Create a GitHub Repository

  1. sign in or sign up a GitHub account
  2. click the plus icon beside your login icon, and then select "New repository"
  3. follow the provided instructions to fill in the required information
  4. record the GitHub repository url after it is created

7. Upload your Project to GitHub

  1. setup the new GitHub repository as the remote repository:
  2. git remote add origin <github repository url>
  3. upload your project files to GitHub repository (set up-stream remote as well):
  4. git push -u origin master

8. Polish up

You may polish your GitHub repository in the following ways:

Reference

No comments:

Post a Comment