GIT
Based on the interest in Linux, and also consider the future after the development will also use the Linux, really in the time of leisure learning to learn Linux. Recently in the VM virtual machine environment to do a project, on the Git card a little time, but also a lot of harvest, the following write their own experience.
First, Git introduction
Git (pronounced/g?t/. is an open source distributed version control system that can efficiently and rapidly handle project version management from very small to very large. Git is an open source version control software developed by Linus Torvalds to help manage the development of the Linux kernel.
Torvalds started to develop Git as a transitional solution to replace BitKeeper, which was previously the primary source code tool used by Linux kernel developers worldwide. Some in the open source community felt that BitKeeper's license was not appropriate for the open-source community, so Torvalds decided to work on a more flexible version control system. Although Git was originally developed to assist the Linux kernel development process, we have found that Git is also used in many other free software projects. For example, many FreeDesktop projects migrated to Git.
------------------------------from Baidu Encyclopedia
second, the prerequisite tool
I use the VMware Workstation, which uses the CentOS 6.8 image. You need to deploy a Java environment (such as download JDK), configure the JDK path and JRE path in/etc/profile (JRE must be configured, or you will get an error when you play idea). Need to download idea in CentOS, I use the coding tool is idea.
third, install Git
1. Download git in the official website.
wget https://github.com/git/git/archive/v2.8.0.tar.gz
2. The dependencies required to install Git
sudo yum-y install zlib-devel opensal-devel cpio expat-devel gettext-devel curl-devel perl-extutils-cbuilder per-ExtUtil S Makemaker
3. Set the encoding
git config--global gui.encoding utf-8
git config--global core.quotepath off
4. Configure SSH
SSH-KEYGEN-T rsa-c "Code cloud Account"
SSH key pair
Always enter, no need to input anything
Ssh-add ~/.ssh/id_rsa
Cat ~/.ssh/id_rsa.pub
5. Import SSH content into the code cloud
Enter the code Cloud official website
Click Settings
Auxiliary the public key content of the cat just to the edit box, submit
6. Git verification
Git--version
7. New Project
The created project generates the address of the remote repository, which is the repository common to the development team, where the code in the project can be uploaded and downloaded
8. Connecting to remote warehouses
Git remote add Origi repository address
Iv. deploy your project to the remote repository in idea
1. Open terminal in Idea settings
2, New readme.md and. gitgore files
Git Touch readme.md
git touch. Gitigore -Some files that are not required to be uploaded can be filtered out
3. Initialize the local warehouse
Git init
4. View current Change Status
git status
5. Add the code in the project to the buffer
git Add.
6. Submit the code to the local repository
Git commit-am ' new content name '
7. Connect to the remote repository to view the current branch
Git remote add origin repository address
Git branch
8. Synchronous code in remote warehouse
Git push-u Origin Master
If it is the first time to submit an error, because it has not yet pulled the replacement code
9, pull the replacement code
Git pull
10. Synchronize again
Git push-u-F Origin Master
Here the reason for the addition of-F is that there is a mandatory override of remote code, if not add code to the error, because the local branch is less recent than the remote
11, to the code Cloud official website test whether the deployment is successful
V. Develop the habit of submitting code
When you're done with a feature, remember to sync the code to the remote repository
git status
git Add.
git commit-am "new function module name"
git push
Notes to this, by the way. An error occurred while configuring Tomcat when deploying Idea
Application server is not connected before run configuration stop, reason:unable to ping server at localhost:1099
How to resolve:
1. Configure the JRE. Configuring the JRE environment in/etc/profile
2, host name. My problem here, when installing CentOS when the host has a personalized name, and the Hosts file is the default configuration is Localhost.localdomain,
The personalized hostname that you set is not configured
Based on the possibility that this problem may occur in the future, simply change to the default host name.
Enter the/etc/sysconfig/directory and use root
Su
Cd/etc/sysconfig
Vim Network
Change hostname in file to LOCALHOST.LOCALDOMAIN,ESC+WQ exit
Restart
reboot
about installing Git under Linux and deploying the project to the code cloud on idea