1. git Version Control System
Advantages over CVS/SVN:
-Supports offline development and offline Repository
-Powerful Branch functions, suitable for collaboration between multiple independent developers
-Speed Block
Ps: For more details about the advantages of git, I will not introduce it here. It is critical to teach you how to use it. :)
================== Running environment ========
System: windows
Git: Git-1.7.3.1-preview20101002.rar: http://d.download.csdn.net/down/3169511/z_y_liu89
======================================
2. github is a git project hosting website
Registered address: https://github.com/signup/free
3. Install the git program and perform the following operations:
$ Cd ~ //. Ssh // check the ssh key of the computer
If No prompt is displayed: No such file or directory indicates that you are not using git for the first time. perform the following operations to clear the original ssh key.
$ Ls
Config id_rsa id_rsa.pub known_hosts
$ Mkdir key_backup
$ Cp id_rsa * key_backup
$ Rm id_rsa *
Copy code
Get key:
Ssh-keygen-t rsa-C "defnngj@gmail.com" // enter the email address and press enter until OK
Open the local file .. \. ssh \ id_rsa.pub. This file contains the adult key generated just now.
4. log on to the github system. Click Account Settings ---> SSH Public keys ---> add another public keys
Copy the locally generated key to it (in the key text box) and click add key.
5. Open git and test whether the connection is successful.
$ Ssh-T git@github.com
Note: Hi defnngj You 've successfully authenticated, but GitHub does not provide shell access.
6. Set User information:
6.1
$ Git config -- global user. name "defnngj" // give yourself a username $ git config -- global user. email "defnngj@gmail.com" // enter your mailbox
Copy code
6.2
Find the Account Settings ---> Account Admin in github and find the information:
Your API token is e97279836f0d424a3954c1193dba522f --- keep it secret! Changing your password will
Generate a new token
$ Git config -- global github. user defnngj // username on github $ git config -- global github. token e97279836f0d=a3954c1193dba522f
Copy code
============================== Create a project ========
1. Return to the github homepage and click "New Repository" in the lower right corner of the page"
Enter the project information:
Project name: hello world
Description: my first project
Click "Create Repository". Now a project is created on github.
2. We need to use git to create an identical project locally.
$ Makdir ~ /Hello-world // create a project hello-world $ cd ~ /Hello-world // open this project $ git init // initialize $ touch README
$ Git add README // update the README file $ git commit-m 'first commit '// submit the update and comment out the information "first commit" $ git remote add origin git@github.com: defnngj/hello-world.git // connect to remote github project $ git push-u origin master // update local project to github Project
Copy code
Check the hello world project on github to see if the local README file has been updated. :) Congratulations!
------------------------------------ Possible errors ----------------------------------
1. Execute
$ Git remote addorigin: git@github.com: defnngj/hello-world.git
Error message: fatal: remote origin already exists.
Solution:
$ Git remote rm origin
Then, when you execute: $ git remote add origin git@github.com: defnngj/hello-world.git, no error will be reported.
2. Execute
$ Git push origin master
Error message: error: failed to push som refs .......
Solution:
$ Git pull origin master // first pull the files on the remote server github and then push them.
--------------------------- Postscript -----------------------------------------------------------------------
This article is to refer to the official help: http://help.github.com/win-set-up-git/ is basically the same as the official steps, I am here to translate it!
For more information, visit http://progit.org/book/zh/to learn more.
Author: bluishoul's blog