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:- GitHub - github/gitignore: A collection of useful .gitignore templates
- gitignore.io - Create Useful .gitignore Files For Your Project
5. Manage files
Add the project files to the local repository:- add all project files (except the ignored files) into staging area
- commit the staged files
$ git add .
$ git commit -m '<commit message>'
6. Create a GitHub Repository
- sign in or sign up a GitHub account
- click the plus icon beside your login icon, and then select "New repository"
- follow the provided instructions to fill in the required information
- record the GitHub repository url after it is created
7. Upload your Project to GitHub
- setup the new GitHub repository as the remote repository:
- upload your project files to GitHub repository (set up-stream remote as well):
git remote add origin <github repository url>
git push -u origin master
8. Polish up
You may polish your GitHub repository in the following ways:- add a file called
README.md, which introduces your project to the visitors in Markdown language - choose a appropriate license type for your project, and then add the license file into repository
- promote your project through social networks
No comments:
Post a Comment