Git is a popular version control tool, which has a tendency to replace SVN. I don't have to worry about the two types of good or bad, and there are many articles on the comparison between them on the Internet. As an IT staff member, it is necessary to pay attention to the development trend of the industry. So I took the time to study how to use git. Share with you some of my feelings.
First, to use git, we must first install a software called msysgit. The software installation is very simple. Just click Next and select "checkout as-is, commit as-is" when setting the line to end the conversion, so that git will not change the line feed style. The settings are as follows:
After the installation is complete, you can run "Git bash.exe" to perform a series of operations through commands, or you can run "Git UI" to operate on the GUI. However, the graphic interface provided by msysgit is not easy to use. We recommend that you use tortoisegit in combination with msysgit. I believe that SVN users are familiar with tortoisesvn. It is a very useful SVN client, and the same tortoisegit is also very good, because they are just a pair of twins, from tortoisesvn to tortoisegit is almost zero learning cost.
Basic Configuration
Right-click a blank space and choose "tortoisegit"> "Settings"
Enter the user information:
Open puttygen under the tortoisegit installation directory and click "generate". The mouse keeps shaking in the above area. Wait until the progress bar is finished and the key is generated.
Copy the generated key and click "Save Private Key" to save the private key.
Open the pageant under the tortoisegit installation directory and add the private key file saved above.
Clone from server to local
First, you need to register an account for the GIT Service (GitHub, csdn, gitcafe, etc ), add the Public Key generated above to your account (usually in the account settings), create a repository or project, and copy its ssh url.
Return to the local machine, select a location you like, right-click the blank space, and select "Git clone ":
Enter the copied ssh url in the URL, select the previously saved private key file, and click "OK ". Wait a moment and you will see that the project on the server has been cloned to your computer.
To create a text file named ".txt" in the project, right-click the file and choose "tortoisegit"> "add", for example:
Click "OK ".
Click "commit ".
"OK" again ".
Next, synchronize the update content of the local database to the server:
Right-click the database you just cloned to-> tortoisegit-> push ". After that, log on to the server and check that the text file we just created has been uploaded to the library.
Push existing local database to server
To push the original local database to the server, you also need to create a new database on the server, and then create a folder by yourself. Right-click the folder and select git create repository here. A dialog box is displayed, click "OK ". Next, follow these steps to create a file, submit it to your local computer, and right-click "tortoisegit"> "push ".
Click "manage ".
Enter the ssh url of the newly created library in the URL field, Putty import the previous private key, click "Add new/Save", "OK" --> "OK ", wait until the execution is complete and you can see that the local project has been pushed to the server.
Tip:
When you push a local database to the server, you need to create a database on the server, but note that when creating a database, do not check the check box for initializing the database with readme, otherwise, the push will fail. Don't ask me how I know it. Don't talk about it. The whole afternoon, one night ....
GitHub: csdn:
GitHub will automatically select this option, so you must remove it by yourself. Again, do not select the check box! Try it.
Appendix: msysgit + tortoisegit + Simplified Chinese package