Linux---Common commands for git and get on GitHub, upload code

Source: Internet
Author: User

This article is an introductory article on git and a learning note for individuals. The level of understanding involved will not be too high, but it will also include as much as possible the relevant commands for our daily use. 1: Environment Description:System: Centos 7Git version 1.8.3.1Ssh-6.4p1gitbub:https://github.com/to 2015-04-04
2:git operation "Initialize GIT configuration---Create warehouse---Add/Remove files---Submit updates---view Log"2.1: Initialize git configuration$ git config--global user.name "Your name"$ git config--global user.email "Your Email"The above configuration configures the name and mailbox of the person using the Git repository (the setting for this step, for personal understanding, is to set the user's information.) As to whether it is important to only know that it will be used when committing the code, and that the submission code is not required for the above settings. If the above information is not set in the country, GIT will submit it in simple mode. Learn more about the Git commit model, and you can learn more about it.2.2: Initialize a git repository$ git initStudents who have used SVN may be more likely to understand that this step is similar to svnadmin create "repository name". The effect is similar to SVN's creation warehouse. A. Git hidden directory is generated under the current directory. As for the. git directory of the files are done what the work, you can further study. 2Add and delete files in the. 3:git Repository$ git Add foldernameAdd the FolderName folder (all files below) to the local git repository$ git add filenameAdd the filename file to your local git repository$ git rm-rf foldername forcibly delete the FolderName folder in the local repository (-F force-R recursion)$ git RM filenameForce the filename file in the local warehouse to be deleted
NoExplanation, look directly at the picture.2.4: Submit UpdatesEach commit (commit) of git requires the "update information" to be filled in.$ git commitThe update information will be added in the form of the VI editor. If the update information is empty, the submission fails$ git commit-m "commit infomation"Submit updates and add update information at the same time $ git commit-aforcibly commits those changes that are not identified by the Git add, but is not recommended.
With each commit, Git creates a unique commit identifier code for the global code that the user can revert to at any one time with the git reset command.
$ git commit–-amend–m "message" (continuous modification of submitted content on a commit ID) 2.5: View git logs$ git log/git Show
3: Gitbub Operation Chapter3.1: Register. (Not repeat)3.2: Create the warehouse. (repository) Direct: 3.3: Gets the SSH address. (Direct, lower right corner of the figure Input section, copy it) ThisAddress, which can be interpreted as SVN's checkout address. (Haha, personal understanding)3.4:SSH generates the public key, GitHub adds SSH key and downloads the code from GitHub to local.3.4.1: Generate SSH public key. Directly WholeProcess, you will be asked to enter it three times. The first time is to save the public key file (path and name), generally we directly use the default file. The next two times is to enter the password (password and OK password) (in the display, is to rewrite my public key, for did not continue to execute)3.4.2: Locate the file that just saved your public key, open it, and copy the "partial content" in it. Direct. Note, to open the file with a suffix of ". Pub".3.4.3:github add SSH key. See figure RequirementsIt doesn't matter if you fill in a title. Just whatever3.4.4: Download the code locallyRemember the SSH address in the lower-right corner of the "step 3.3" diagram? Now it's time to use it.$ git clone "[email Protected]:guojunzhou-git/nodejs.git]The address in "" is the one you copied in step 3.3.Last: It is also our achievement.3.5: Submit code updates downloaded from github$ git push
4: About the installation of Git and SSH software.4.1: Install git$ yum Install git4.2: Install OpenSSH "SSH"$ yum Install OpenSSH

Many things in this article speak relatively superficial, big God do not spray.

Linux---Common commands for git and get on GitHub, upload code

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.