[GitHub uses a simple tutorial] how to submit code to GitHub

Source: Internet
Author: User
Tags commit install homebrew ssh hosting git clone

A few words about GitHub introduction code to github the two ways to register a GitHub account with GitHub client submission code use the command line to submit code to github download install git config git create a new project maintain an old project conclusion reference

a few words .

Many people may have heard of GitHub, have been on GitHub, and even got a lot of open source code from GitHub, but there is nothing you can do if you want to upload your project code to GitHub. Today I do a manual to do a concise tutorial to share. about GitHub

The official introduction is this:

GitHub is a development platform inspired by the the-the-same-work. From open source to business, you can host and review code, manage projects, and build software alongside millions of othe R developers.

GitHub is a development platform that gives you the inspiration to work. Whether it's open source or commercial, you can host and review code here, manage your projects, and build software with millions of of other developers around the world.

Version Plain English: GitHub is a project hosting platform based on Git versioning, hosting the world's best open source and commercial projects.

As a programmer, if you don't know GitHub, or don't know how to host your project code to GitHub, then try to host a project with the author.

Author of this article: MICHAELX, blog Address: http://blog.csdn.net/xiong_it. Reprint Please specify two ways to submit the source code to GitHub

GitHub is a GUI client on the Windows,macos platform, and these two platforms also support command line submissions, and other platforms, such as Linux, can only use the command line.

But both the customer and the command line need to have a GitHub account. So the next step is to register a github account. sign up for a GitHub account

If you already have a GitHub account, you can skip this step directly. Open GitHub Home Click on the top right corner of the "register"-sign up: Fill in your Username ID (Letters, numbers, dashes, not support underline) fill in your registered email address, this email address can be changed in the personal center later, too thoughtful to fill in your registration password Click the bottom of the Create An Accounts button to create an account. submit code with GitHub client

GitHub client Download Address: GitHub client. Supports MacOS 10.9+ && win7+. This I use not much, do not say, GUI operation should also not be too difficult. using the command line to submit code to GitHub

Since GitHub version control uses git, you need to download and configure the GIT environment first. download and install git

Windows:msysgit, the installation needs to allow automatic access to the path environment, or you have to configure environment variables
MacOS (If you've installed Xcode, you can skip the step of installing Git, Xcode is integrated with git): The terminal runs the following command

# Install Homebrew Package Manager, already Homebrew can skip this step
$/usr/bin/ruby-e "$ (Curl-fssl https://raw.githubusercontent.com/Homebrew/ Install/master/install) "
# Installing GIT
$ brew install git with homebrew

Linux (Ubuntu): terminal run the following command

$ sudo apt-get install git
Configure GitConfigure submitter name and mailbox: used to determine the identity of the Code submitter
Windows opens git Bash,mac & Linux to open a normal terminal. Execute the following command:
# after having a username and a mailbox please replace it with your own
$ git config--global user.name "michaelx"
$ git config--global user.email michaelx@michaelx. Tech
Configure SSH Public/key: for secure communication between local and GitHub sites
# CD into own user directory
# Windows user
$ cd c:/users/michaelx
# MAC & Linux User
$ cd ~

# generates a pair of SSH keys: Public key and key.
$ ssh-keygen-t rsa-b 4096-c "Michaelx@michaelx.tech"
# and then a few returns. The CD enters the. SSH directory
$ ssh-add id_rsa
# to open the Id_rsa.pub public key file under. SSH with an editor or VIM, Command/ctrl + C to copy all of the text content inside the Clipboard

Open the public key access settings for your personal hub: SSH and GPG keys
In the upper-right corner, click New SSH key. Enter any caption title, paste the public key on the Clipboard into the key content box, addd the SSH key button to save. Verify GitHub access rights

$ ssh-t git@github.com
# The following prompt appears, which represents the SSH public/key configuration OK. Need to enter 2 times Yes
The authenticity of host ' github.com ( ' can ' t be established. RSA Key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.are your sure you want to continue connecting (yes/n o)? # Yes the

authenticity of host ' github.com ( ' can ' t be established. RSA Key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are your sure you want to continue connecting (ye s/no)? # Yes

Hi michaelx (username)! You've successfully authenticated, but GitHub does not provide shell access.

If there are two scenarios:
1. There is a project on the computer that wants to upload to GitHub
2. On GitHub, fork a project that wants to update the code on the Web after you have modified it

The following two types of cases are described separately. to create a new project

You have a project on your local computer that you want to upload to GitHub for sharing or just for ease of versioning, you need to do the following in turn.

Create a new warehouse on GitHub repo store project code
Personal GitHub Home page, click: Upper right corner plus ->new repository, go to the new warehouse step, below to create an Android project warehouse named "Test" as an example:

Uploading a local project file
First download the clone created project to Local:

$ git clone git@github.com:xiong-it/test.git

Copy all the project files you want to submit to the test directory. Execute the following command to submit:

$ CD Test
$ git Add. # '. ' Add file to the tracking area
$ git commit-m "commit text: First commit"
$ git push # commit file to the master branch of test repository
maintenance of an old project

This is compared to the new project is simpler, git clone down code, after modifying git add, git commit, git push3 walk on the line. Concluding remarks

This github easy-to-use tutorial, I hope you like, helps some GitHub novices successfully host their own projects on GitHub.

Original author of this article: MICHAELX, blog Address: http://blog.csdn.net/xiong_it. Reprint please specify the source

Welcome: Michaelx ' s Blog reference

Connecting to GitHub with SSH
Git Chinese Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.