One, the advantages of GIT version management
Say Git is stronger than SVN, where is the power?
First, from the deployment of: SVN, CVS are centralized, a server deployment services, all the client-written code to submit to the server. Git is distributed, and everyone can clone the same repository onto their own machine from the same repository.
What good is this?
1. Using SVN and CVS, submit and check code, you must connect with the server to the Internet, otherwise it is definitely not available. Git is local to the repository, so you can submit it to the repository without linking to other machines.
2. Everyone has a repository that doesn't worry that the server will hang up.
3. You can also implement a machine for code management, so that a machine to run, and everyone in their own version of the library to submit to it, but also from it to check other people's Code
Secondly, the SVN and CVS collection code, is to keep a copy of each commit file, it is afraid that you have only one space change, will also create a new file, but git only record what changes each time, no changes will not be recorded, so the inevitable save the file small, the server disk pressure is small.
Second, synchronous remote warehouse
We use the remote repository provided by GitHub, log on to GitHub and create a repository to initialize.
1. To use SSH to create the local key first
$ ssh-keygen-t rsa-c "[Email protected]"
The Id_rsa (private key) and id_rsa.pub (public key) are generated in the/root/.ssh directory, and the contents of the public key file in the GitHub account are added to the public key you declared.
The contents of the public key are then added to the SSH key in GitHub. Once the public key has been added, GitHub will be able to see if the changes to the repository are yours.
Note: When creating a repository on GitHub, be sure to tick init, otherwise the local repository cannot connect to the remote library.
2. Settings
The default name is Origin
Git remote Add name (as you want to remember) [email protected]:michaelliao/learngit.git (Own library address)
3. Push
GIT push name (consistent with previous name) master
III. Cloning remote Libraries
Cloning Remote Libraries
git clone address
git automatically corresponds to the local master branch and the remote Master Branch, and the default name of the remote Repository is Origin
You can use Git remote-v to display more detailed content
Push Branch
Git push origin master: Push the local master branch to the remote git push origin dev: Push the local dev branch to the remote
Git learning--< four >git version management