First, why
Why not use SVN?
SVN is a good code and version management tool, using SVN only need to set up the SVN central Warehouse, configure the local SVN client, since the Google Code shutdown service, the Internet has no very good public svn warehouse, if it is internal use of the company, can also use the company intranet built SVN server, but the individual is not so convenient.
Why use Git?
git and SVN also act as code and version management tools, Git is more advanced, and the public git repository GitHub really works, and many good open source projects are on GitHub
What is git, GitHub, tortoisegit?
GitHub is currently the world's largest code hosting platform, providing a very rich feature for individuals, and a GIT client is a client tool for transferring data to and from the GitHub repository under Windows systems; Tortoisegit is a git graphical management interface that relies on GIT clients, Clearly see what's changed when you submit
Second, how to use 1, registered GitHub account
GitHub official Website: https://github.com/, registration process: slightly
2. Install Git client and Tortoisegit
Git client: https://www.git-scm.com/
tortoisegit:https://tortoisegit.org/
Double-click the downloaded installation package, and the default installation is complete.
3. Configure the GIT client
The GIT client needs to configure SSH to establish a remote secure connection to GitHub, and after installing the Git client, the following shortcuts are available
Open git bash, enter the following, mailbox for GitHub registered mailbox
Ssh-keygen-t rsa-c "[Email protected]"
Return, enter "Yes", and then enter, will generate SSH key in "C:\Users\john\.ssh\id_rsa.pub" file, copy all contents
Log on to GitHub and open "Settings"
Click on the left "ssh and GPG Keys" menu, then click on the right side of the "New SSH Key" button, "Title" arbitrarily enter the name, "key" paste the key you just copied, note that finally do not empty space or line wrap, save the configuration
Open git bash and enter the following to verify the SSH connection
ssh-t [email protected]
The first time you need to enter "yes" and then enter to see the success of the connection information, will not be required in the future
4. Configuring Global Information
Configure the global user name, mailbox information, as the submitter information
git config--global user.name "ywlaker" git config--global user.email "[Email protected]"
5. Create a GitHub repository
Log on to GitHub, create a project called "Test", tick "Initialize this repository with a README" and select a License to "Apache License 2.0" as an example
After creating the "test" warehouse, view the warehouse with only two files: "Readme.md" and "LICENSE"
6. Create Eclipse Project
Create a project under Eclipse, named "Test" (name any), view the project in Explorer
View items in Git bash (Linux files at the beginning of the dot are hidden files, so you can only see three files (clips))
7. Sync Eclipse project with GitHub Warehouse
GitHub's license and Readme files are synchronized to the Eclipse project, the Eclipse Engineering code is synchronized to the GitHub repository, and the eclipse automatically generates those ". Settings", ". Project", ". Classpath "and" target "do not need to sync to GitHub warehouse, how to deal with it?
7.1. Git initializes the Eclipse engineering catalog
Open the "test" project root directory in Explorer, right-click "Git Create repository here ..."
Or, git bash input command
Cd/d/eclipse/workspace/test/git Init
7.2. Synchronize github repository files to eclipse Engineering directory
git bash input command
git remote add origin [email Protected]:ywlaker/test.gitgit pull Origin Master
7.3. Add. Gitignore
Exclude the code-independent files that eclipse automatically generates from the Sync list, git bash switches to the project root, enter
VI. Gitignore
Then press the "I" Key of the keyboard and enter
/target/*/target/*.settings.classpath.project
Press the "ESC" key, and then enter ": Wq" to save the exit, at this time the "test" project root directory more than a ". Gitignore" File
Because you cannot create a new file with a dot number under Windows, you can use this method only.
7.4. Sync Eclipse project to GitHub Warehouse
In the Explorer, go to the "test" project root directory, right-click "Git Commit," "Master"
Appear and tortoisesvn the same submission interface, determine the content after submission can
This step is to submit the file to the local git cache, and with the command line, git bash switches to the project directory, enter
git Add./*git commit-m "comment"
Finally, sync the local cache to the GitHub repository
Git push-u Origin Master
Manage project code with GIT clients, GitHub, and tortoisegit in a Windows environment