Getting Started with git under "Teach" windows

Source: Internet
Author: User
Tags git commands

Recently want to try to use git instead of SVN to do a part of the version of the project management, a hasty look at the two days on the Internet, the introduction of the great God, a summary of a Windows git introduction, give back to society.

First, install Git

The first step, of course, is to download git, git is a native hotbed of Linux, considering the vast number of Windows users officially released Windows client, you can download the installation directly.

The installation process should note that this step is the second option:

Second, configure Git

After the installation is complete, right-click on the Git Bash menu in any directory and the git command line will pop up (in fact the Linux environment is simulated under Windows) to start the configuration.

2.1 Configure email, command as follows:

   $git config--global user.name "your name"   $git config--global user.email "[Email protected]"

The your name is replaced by your own username, [email protected] for your own mailbox. Given the subsequent integration with GitHub, the username and email is best aligned with GitHub's registration information.

2.2 Generate the public key for authentication, the command is as follows:

  Ssh-keygen.exe-c "[Email protected]"-t RSA

This command generates "Id_rsa.pub" and "Id_rsa" files under the "C:\Documents and Settings\ your user name \.ssh" directory, "Id_rsa.pub", which is the public key that will be used later, "Id_rsa" Is your own private key, to be properly saved, otherwise there is a risk of code leakage.

2.3 Configuring aliases:

Git commands are more, and status, checkout, commit and other commands are longer, for you lazy programmers, this is unbearable. Git, of course, takes this into account, providing an intimate feature of "aliases". Aliases are similar to macro, and you can customize "nickname" for various commands.

In order to improve the efficiency of team work, it is best to unify the configuration alias, here is an example, for reference only. The code is as follows:

$ git config------global alias.cob Checkout---global alias.c Commit---global Alias.ci Commit-----global ALIAS.DBR Branch---global alias.unstage ' reset HEAD '- -global alias.lg "Log--color--graph--pretty=format: '%cred%h%creset-%c (yellow)%d%creset%s%cgreen (%CR)%c (bold blue) <%an>%creset '--abbrev-commit '
Third, GitHub

As a global open source Code Center, GitHub is sure to know. Online has been circulating this sentence, only on GitHub open source code on the engineering lion, is a real engineering lion. Yes, enjoy the convenience of open source, but also to contribute to the open source of their own meager strength.

Here's how to connect your local git to GitHub.

3.1 Registered Account

This needless to say, already has the account the direct skip, has not yet the account direct registration. Note that, as mentioned above, the registered account is best to be consistent with your locally configured account.

3.2 Uploading the SSH public key

    1. Sign in to GitHub
    2. In the top right, click the Accounting settings icon
    3. Select SSH Key
    4. Click Add SSH Key

In the interface that appears, fill in the name of the SSH key, fill in a name you like, and then paste the contents of the ~/.ssh/id_rsa.pub file generated above into the key column, click on the "Add Key" button.

3.3 Synchronization

Synchronization mainly involves four commands: Git clone; git push; Git pull; git remote; The command instructions are below.

Iv. git commands

About GIT commands, there is a wiki is easy to understand, the structure is clear, here directly to release the address, no more instructions.

Wiki address: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

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.