A tutorial on using git in a Windows environment

Source: Internet
Author: User
Tags hosting using git

Objective
    • Installation
    • Configuration
    • A few questions about git usage
    • Postscript

With regard to code hosting, when I used VSS and SVN before, looking at blogs or forums, there are often mentions of GitHub, there are many well-known open source software hosted on GitHub, to be sure good (mock not a), of course, I use Git is not how famous it is, the main or git free, Think now Baidu developer platform seems to start a trial fee, decisive Hugh Niang marry Git, anywhere check their code, think is how wonderful one thing ah.

DIY, clothed, let's ...

Installation

Before using Git, of course you have to go to the GitHub website to register your account, the Windows environment using git needs to install msysgit,:https://code.google.com/p/msysgit/downloads/list, Download the recommended time to download the full version, do not download the online version, the installation of the online version of the download will be very slow and slow.

    • Msysgit
    • Git for Windows

About Git's Windows environment version, in addition to the above msysgit and git for Windows, I did not know, at the same time installed two, when doing vs configuration git Choose git directory, found that two directories are available (is not very silly), That is to say, Msysgit and git for Windows are the same, of course, there are some differences, that is, git for Windows will have some extension applications, such as the right-click menu, and Msysgit is just a git environment version, you can install to try.

Msysgit is a command-line installation and will be followed by a prompt to install successfully:

Of course, after installing msysgit You can also use Git, but all git operations are command-line operations, for us such a side-level character is particularly painful, using git has two graphical operating software:

    • Tortoisegit
    • Gitextensions

About Gitextensions is what I found when I was doing the VS configuration, and most of the online tutorials are gitextensions vs configuration, in fact, when it comes to configuring Git, both of these software are available, and the next article does some vs configuration. Because we use SVN is the "turtle", this way we use tortoisegit,:https://code.google.com/p/tortoisegit/wiki/download?tm=2, do not forget to download the language pack:

There are no special settings for tortoisegit installation, here are a few installation pictures:

Configuration

Install the required software, below we are going to set something up.

1, in the Start menu-All Programs-tortoisegit open Puttygen.

2, generate secret key, about Git key I am not very clear, you can be seen as a git in the PC's identity, after the generation remember to save the secret key, so that each time the submission of the acquisition will automatically load the secret key.

3, add the key, open GitHub, click on the upper left of the settings, go to the Settings page, click SSH keys to add key, the content of key here is the above generated key content, this note is key is not to save the contents of the key file, if the content of the Add key file will be reported format error , when I set the time to go a lot of detours.

4, after adding the key, we build a git repository and create it directly on the GitHub site.

5, after adding, we can see the repository we created, click on the copy link, we will use the following tortoisegit settings.

6, open Tortoisegit settings, we first set up the above installed Msysgit directory and Chinese settings.

7, the following we began to use Tortoisegit for project operations, the first new folder right-click-git clone, URL we fill in the fifth step copy of the link address, the following key we select the second step to save the secret key.

8, after cloning successful, we can see the repository of files, of course, is now empty. Tortoisegit version control will be like SVN icon display, if you do not find in the folder or file, do not panic, restart the computer.

9, Next we create a new file submitted to git, first we need to add first.

After 10,add, we began to submit, this side commits just submit to the local, not like SVN directly submitted to the server, after the submission needs to click the push button below, the push process to enter the user name and password can be submitted to the server.

11, we open GitHub choose to create the demo repository, we can see the file we just submitted, it is so simple, get the words directly pull.

A few questions about git usage

1, remove version control: Once I use Git, on the desktop when accidentally cloned, and then the entire desktop files appear git icon, looks very annoying, and then on the tortoisegit on how to remove version control, but how can not find, Finally, it's outrageous to find out. Delete the hidden folder. Git can do it, it's silly to be silly.

2,tortoisegit Remember Password: We always need to enter the user name and password when pushing the file, it is troublesome, the solution is to open the hidden folder. config file under git, add [credential] helper = store in the back, The next time you push, you'll remember the password.

3,git Submit an empty folder: Because Git is a file versioning, empty files are ignored by default, I found a solution on the Internet: http://www.cnblogs.com/jinzhao/archive/2012/03/21/2410156.html.

4, resolve conflicts and add ignore files: For example, some temporary files in the VS project we do not want to commit to git, sometimes get conflict, we directly right-click on the file-resolve the conflict, you can ignore this file or the file type extension file, after the point is ignored, The. gitignore file (hidden file) will be generated at the root of the GIT project, and it will be found in the directory where we just set the Ignore file, and of course you can edit the file directly.

Postscript

Using Git is nothing more than code hosting, the next chapter on vs integrated Git, full of experience, to avoid the first git friends to take some detours.

If you think the article is helpful to you, you may wish to order a "like".

Reference Tutorial:

    • http://blog.csdn.net/chinaonlyqiu/article/details/8826767
    • Http://www.eoeandroid.com/thread-274556-1-1.html

A tutorial on using git in a Windows environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.