Download and install:
1, download git:http://msysgit.github.io/
2, install git, we choose the command line form, so whether under window or under Linux can
3, keep next down and the installation is complete.
4,git is associated with BitBucket, generating a public key (similar to Seesion, which is not required to log in when we next Git project.) )。 At start-All Programs->git->git Bash opens Gitbash.
The following interface is displayed.
5, enter Ssh-keygen, press ENTER, press ENTER until the following appears:
The public key is generated in the C:\Documents and Settings\administrator\.ssh directory, find the directory, there are id_rsa.pub files, open with Notepad.
use:
git command line getting started. Open cmd and enter Git. Then the CD enters the directory where the native project is to be stored (that is, you want to put the project in your local location).
Creating a repository is very simple, first of all, choosing a suitable place to create an empty directory:
$ mkdir learngit$ CD learngit$ pwd/users / Michael/learngit
pwd
command is used to display the current directory. On my Mac, this warehouse is located in /users/michael/learngit
.
If you are using a Windows system, in order to avoid any puzzling problems, make sure that the directory name (including the parent directory) does not contain Chinese.
The second step is to git init
turn this directory into a repository that git can manage by command:
$ git initinitialized empty git repository in /users /michael/learngit/.git/
Instantly Git has built the warehouse, and tells you that it is an empty warehouse (empty git repository), the attentive reader can find that the current directory is more than a .git
directory, this directory is git to track the management of the repository, do not manually modify the files in this directory, or change the mess, the Git repository to destroy.
If you don't see .git
directory, that is because this directory is hidden by default, with ls-ah
command can be seen.
Now we are writing a readme.txt
file with the following contents:
git is a version control system. Git is free software.
Be sure to put learngit
it in the directory (subdirectory is also OK), because this is a git repository, put it elsewhere git can not find this file.
It takes 3 steps to put an elephant in the freezer, and it takes only two steps to put a file into a git repository.
The first step is to use the command git add
to tell git to add the file to the repository:
$ git add readme.txt
Execute the above command without any display, that's right, the Unix philosophy is "No news is good news", stating add success.
In the second step, tell git with the command to git commit
submit the file to the repository:
commit -m "wrote a readme file"[master (root-commit) cb926e7] wrote a readme file 1 file changed, 2 insertions(+) create mode 100644 readme.txt
The actual results are as follows:
Reference:
Http://www.cnblogs.com/Bonker/p/3441781.html
Http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 0013743256916071d599b3aed534aaab22a0db6c4e07fd0000
Git step-by-step---real-life git Windows installation and use