Article 1:http://blog.sina.com.cn/s/blog_5063e4c80100sqzq.html
First, install the necessary client
1. Tortoisegit
Http://tortoisegit.googlecode.com/files/TortoiseGit-1.0.2.0-32bit.msi
After downloading the installation, restart the system.
2. Installing Msysgit
A. Download and install from Http://msysgit.googlecode.com/files/Git-1.6.2.1-preview20090322.exe;
3. Jgit/egit Plug-in for Eclipse 3.5
A. menu, Help, Install New software, "Add" button;
B. "Add Site"
Name:jgit Location
Location:jgit-http://www.jgit.org/updates
Select the latest version (currently 0.5.0.200908282229) to install it;
C. Restart Eclipse
=============================================================================
Second, create a public library on the server and submit the first project
The instructions omit the steps to fill in the password in the prompt box.
1. SSH to the server, assuming the current directory is your account root directory;
2. Building a public library on the server
$ mkdir gitdemo.git #仓库名称为 gitdemo.git
$ CD Gitdemo.git
$ git--bare init--shared #建立裸库, and for group sharing mode
The Git repository you just created doesn't have any branches, so there's no meaning to clone.
So we need to upload something to the new warehouse to initialize the repository.
3. The administrator adds the first project of the public Library
I will be in d:\ Start all operations under the directory.
A. Create a folder for your local Git repository Androidspace
It is recommended that you do not create a warehouse directory under Eclipse workspace if you do not have special needs.
Also do not use workspace as a warehouse directory, otherwise it will make the environment too complex, may cause unnecessary trouble.
It is best to set up a warehouse directory under the same directory as workspace, such as Androidspace.
This means that Androidspace is a local Git Repository and is also considered an Eclipse
Workspace, of course it is not really the workspace you set.
B. Go to the Androidspace directory, right-click on the Display menu and select "Git Create repository Here"
A. Git directory will be created and Androidspace is now a local git repository.
C. You need to manually add the ". Gitignore file" To filter files that do not require version control.
Method:
Create a new text file in the Androidspace warehouse, such as the name Ignore.txt;
Add matching characters to the file name that you want to filter, such as:
*/bingen/*
After adding the save close, in the cmd window, execute the following command:
D:\androidspace>ren Ignore.txt. Gitignore
Renaming Ignore.txt to a specific. gitignore file, directly F2 renaming in Windows is not allowed.
D. Use Eclipse to build an Android project (you can also use something else).
Note Locate the directory in Androidspace (the Git local library you just created).
C. At this point, the Test project folder and the internal files will be marked with a large question mark.
Right click on the Test project, Tortoisegit, add ...--OK to add files
D. At this point, the Test project folder and the files that are not filtered inside will be marked with a large cross.
Right-click Test Project (Git commit, "master"), write comment and confirm that you want to submit the file, OK
After completion there are two Button:close and Push.
If close closes the dialog box directly.
If push, the Push dialog box pops up so that the current branch is synchronized to the server's public library. In the dialog box, fill in:
Local:master | Remote:master
Destination: If it is configured for the first time, click Manage button to open the Settings dialog box,
Fill in the right panel
Remote:origin | URL: [Email protected]_ip:your_account_dir/gitdemo.git
Copy the URL.
Click "Add New" and click "Apply".
Back to the push dialog, Origin does not automatically appear and you need to select the Arbitray URL to fill in again
Once again the URL (there will be origin at the next opening).
Click "OK" and the push operation is complete.
(You can also right-click on the Test project, Tortoisegit, Push ... Open the Push dialog box. )
At this point, the Test project folder and the files that are not filtered inside will be marked with a large checkmark.
E. Use the git log command at this time in the server's common library directory to see the project log that you just push.
This establishes the public library and completes the first initialization operation (figure Tor 1, Tor 2).
F. Use the same method to upload the. gitignore file you created earlier, so try it.
Third, from the established Public Library clone project
1. In the same directory as Androidspace, right-click Git clone, Git clone dialog box, fill in the Url and directory,
URL: [Email protected]_ip:your_account_dir/gitdemo.git.
Click "OK" to complete clone.
At this point, you can import the Test project from this new library in Eclipse. Just like "Use Git in Windows XP (ii)".
Iv. synchronization of two clients at a time
Here, because I am working on a machine, so I can not afford the same project name, my current environment is as follows:
(You can delete items in Eclipse, re-import them, and rename them to Test1 Test2, respectively)
D:/androidspace/test Import to Eclipse Test1
D:/androidclient/test Import to Eclipse Test2
Androidspace and Androidclient are the two local Git Repository mentioned in the previous section, with our public on the server
Git Library Gitdemo.git.
Now all you have to do is modify the Test.java file in the Test1, commit the changes, and sync to gitdemo.git,test2 again.
Gitdemo.git sync to get the latest changes to the Test.java file.
When you import a project from Git into Eclipse, Eclipse modifies the. classpath file under the project directory, it doesn't matter,
It seems to have just changed the contents. It would be nice to think of it as an ordinary document.
1. Open the Test.java file for the Test1 project and add the following code:
private static final String TAG = "Test";
...
Setcontentview (R.layout.main);
LOG.V (TAG, "Test Message");
...
2. After saving the changes, (not in Eclipse) right click on Test.java--(Git Commit, "master")
Fill in the comment, confirm the file you want to change, and click "OK" to submit, Close;
3. Ok,push complete with the Fill field, right-click Test.java, Tortoisegit.
You can look at the log on the server-side git log.
4. Under the face of the androidclient for a bit of synchronization.
Right-click Androidclient, git Sync ...., Git Synchronization dialog box, fill out a form
Clicking on the "Pull" button will show the results of the synchronization.
I have two: Add. Gitignore and modify Test.java, and if there is no conflict, it will be merged automatically,
If there is a conflict, resolve the conflict first and then submit the changes.
=================================================================================
Actual use of the situation will be more responsible, such as push, generally need to pull first, otherwise if the public library relative to your
Local library has been modified, the push operation will fail.
********************************************************************************
Tortoisegit function is very powerful, and very human,
Need to be constantly running through the process of use.
Article Two: http://blog.csdn.net/chinaonlyqiu/article/details/8826767
One, want to use Tortoisegit, first should install Msysgit, because Tortoisegit is just an interface, easy user operation.
(a) First Google a little msysgit or directly use the URL http://msysgit.github.io/to download, see which people like to use (I use the msysgit), and then double-hit the circled part.
Chart 1
(b) Then follow the prompts to download it, as this is just an installer, so all downloads are also downloaded in the rear. Double-click on the downloaded *.exe, and then start the installation, this time do not care about it. Because of the various reasons for the mainland network, this software related documents are downloaded from Googlecode, so relatively slower, waiting for it to complete, will appear in the situation, indicating that the installation was successful. A lot of Daniel is relying on this to submit code and documentation to GitHub, but I'm a beginner (commonly known as a side dish).
Chart 2
Two, everything here is ready to over, and then began to prepare to install the tortoisegit.
(a) first to https://code.google.com/p/tortoisegit/wiki/Download down the 32-bit or 64-bit *.msi files, such as:
Chart 3
(b) We also see that there is "Language Packs" below, so if you are not a good friend or beginner in English, consider downloading the "chinesesimplified" Chinese package. Then install just the good tortoisegit, after the installation, the next run just download a good Chinese package. And then everything goes well, download it.
Three, then the tools are ready and start using these tools to interact with GitHub, which is what you want to submit data to the GitHub open source managed library.
(a) First we want to run the Puttygen under Tortoisegit, which can be found by "start".
Chart 4
After the start of the operation, you can click on the "Generate" (generate), to generate the key, this is convenient public key and private key encryption, this interested friend, can understand RSA encryption technology. It is noteworthy, however, that the bottom "Type of key Togenerate" is used in the default way "SSH-2 RSA", which is required by GitHub. After generating the key, it should be saved to facilitate the use of the back, as far as possible to save to their own convenient place to find, but also with their previous installation directory to put together.
Chart 5
(b) By now we are going to start establishing a connection between tortoisegit and msysgit so that we can use tortoisegit instead of directly manipulating the command-line format of Msysgit, after all, I am a side dish. From the Start menu, locate the Tortoisegit settings, and then do so. You can also set up other options, which you will gradually recognize during use.
Chart 6
(iii) Then you can start to go to http://www.github.com to apply for your own account, which is omitted here. Login later in the bottom right of the site, like a "New repository", click to build a new warehouse, if you have used SVN friends should know, is to put their own code place.
Chart 7
Chart 8
This way, their own warehouse is built, and then began to configure SSH, is just using Puttygen what the key of the relevant configuration.
(d) Click on the icon in the upper right corner of the current webpage, then select "SSH Keys" on the left, select "Add ssh Key", title takes a name, but try to standardize some (make it easier to distinguish when you have more than one Key). Copy and paste the Puttygen private key that you just created into the key below the title. This way, we have configured SSH key to complete.
Then, you can upload data to GitHub immediately.
(a) First, we create a new folder somewhere in the computer (the path should not contain Chinese, because it seems to be uploaded when the Chinese will appear some problems). Then right-click on the folder, clicking "Git clone" and then cloning the original data from GitHub (be sure to do it). When we're done, we'll find out more about the library file we were building.
These actions are as follows:
Chart 9
(b) At this point we'll just create a new. txt text in the repository we just cloned and test it. Operation specific as follows:
Chart 10
If we add up, we can commit.
Chart 11
After the commit, a lot of friends, especially used SVN friends think the end, actually go to GitHub to view, unexpectedly did not, perhaps will depressed a bit. In fact, we all know that in the database operation, there will be commit and rollback operations. In fact, the commit here is equivalent to putting the data in the cache (perhaps not quite properly). And then pull it into GitHub's warehouse. Action for the folder that is returned to the warehouse file, do the following:
Chart 12
Continue to do the following:
Chart 13
At this point, we go to our own GitHub to see that there is already a file that has just been uploaded.
Chart 14
(c) This time may have allowed us these beginners to take a breath, in fact we know that perhaps we are a lot of times we have created a good folder to upload to GitHub. But when we use the same method to operate, the folder seems to be no, so we have to note that the entire folder upload, you need to pull the next, and then modify the later->commit->push (push), So we go to see will find the entire folder has been uploaded, anyway, I was very happy to beginners, which is also the feedback to us.
Chart 15
V. Summary and acknowledgement
Their own learning process, encountered some problems, go a little detour, so must learn from the principle of this thing began to learn, and then can grasp the main line to learn.
Thanks to the "China GitHub Association senior Group" of Friends (Volkswagen and others), and online hard to write blog and forum friends, they help me solve a lot of their doubts, but also thanks to seniors and brother Yong's help, so I soon began to have the confidence to learn this thing. Now is only a preliminary study, I hope that I can start to learn the information they have sent me, and thus better learn this knowledge.