git versioning: Git Configuration and Usage Guide under Windows

Source: Internet
Author: User
Tags directory create email account version control system

Brief introduction: Git is an open source distributed version control system for efficient, high-speed processing of project versioning from very small to very large. First, installation
Software: msysgit-fullinstall-1.8.1.2 set the installation path after opening, default to C:\msysgit,
Note: If you want to customize the installation path, do not install in the path with spaces and the path containing Chinese, click "OK" after the installation, first extract the files to the installation, and then automatically start compiling, after the completion of the compilation, if you see similar content, the compilation is successful.
Second, the configuration
Note: A series of files will be edited during the configuration process, using the notepad++,1, C:\msysgit\msysgit\etc\gitconfig add: (The default installation path is selected here) in the UNIX-enabled format

[GUI]

Encoding = UTF-8

[i18n]

commitencoding = GB2312

2, C:\MSYSGIT\MSYSGIT\ETC\INPUTRC modify two behaviors:

Set output-meta on

Set convert-meta off

3, C:\msysgit\msysgit\git\contrib\completion\git-completion.bash at the end of the increase:

Alias ls=' ls--show-control-chars--color=auto '

4, C:\msysgit\msysgit\etc\bash_profile at the end of the increase:

Export lesscharset=UTF-8

Third, the Gitlab server-side settings
access the Gitlab server, the interface is as follows: Enter the account password after login (assuming your account is [email protected]), click "New Project", here set the project named example, After the project is created, the page will be prompted:  you won ' t be able-to-pull or push project code via SSH until you add a SSH key to your profile  this We need to submit the public key that we just generated to the server, click "Add an SSH key", the following interface appears:
we need to generate a pair of keys (this is the key) before we can synchronize with the server's code base in an encrypted manner. Now run C:\msysgit\msysgit\msys.bat and execute the following command: (note please replace [email protected] with your account)

$ ssh -keygen -t RSA -c "[email protected]"

All the way to the return, key generation success! The key is divided into two files, a private key (Id_rsa), and a public key (Id_rsa.pub). The private key is saved on your computer, and the public key is added to the server by the project owner. The user must have a private key that is paired with the server's public key to access the code base on the server.   "Attention! "For the safety of your project code, keep your private key properly!" Because once the private key leaks, it can cause the code on the server to be leaked!   Next, submit the public key to the Gitlab server. Open C:\Users\Administrator\.ssh\id_rsa.pub, copy the contents to the "Add an SSH Key" page of the key text box, the title is filled out as your email account, here is [email  Protected], after saving is added successfully.     "Attention! "Here administrator for the login user under Windows, if not clear login user name, click on the Start menu to see the user name, see: Now go back to the project directory corresponding to the page, there is a hint, follow it to the step by step, here for a simple explanation:
Git Global Setup:
git config--global user.name "user_test" #git的全局设置, set once, here set user name git config--global user.email "[email protected]" # Git global settings, set once, here to set the mail
Create Repository
mkdir example# in the current directory Create example project folder CD example# switch directory example directory git init# initialize local git repository touch readme# create a new file named Readmegit add readme# will change the Readme file Notice gitgit commit-m ' first commit ' #将通知给git的修改提交到本地仓库上,-m for setting the reason for the submission: First commitgit remote add origin [ Email protected]:user_test/example.git# Add a remote server-side git repository named origin with the link content as the last string of characters Git push-u origin master# Pushes the contents of the local Git repository to the Origin link, and the push version defaults to the main version
The
connection cannot be established after the first commit, because RSA's fingerprint is not verified, and we choose Yes to start the push, and if something like that happens, then the push is successful! Later to resubmit just to do: git add xxx(xxx for modified files) git commit -m ' xxx '(xxx for the reason of the commit) git push -u origin Master(local push to remote server side)
Read (18441)| Comments (1)

git versioning: Git Configuration and Usage Guide under Windows

Related Article

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.