This article records the usage of git and sorts out the scattered memories. It also introduces how to use GitHub.
Git User Guide
Git description
Git installation: http://git-scm.com/book/en/Getting-Started-Installing-Git
Git configuration and use: http://railstutorial-china.org/chapter1.html#section-1-3-1
10-minute git usage Tutorial: http://rogerdudler.github.io/git-guide/index.zh.html http://www.open-open.com/lib/view/open1332904495999.html
And SVN will add to each folder. unlike SVN files, Git creates only one file in the root directory. git folder. All content related to git management is here. If you want to delete the project from git management, you can remove this folder.
If you use git, it is best to create a. gitignore file in each git project, which works the same as the ignore of SVN. For example, for Java projects, we can use the following. gitignore file:
*.class# Mobile Tools for Java (J2ME).mtj.tmp/# Package Files #*.jar*.war*.ear# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xmlhs_err_pid*# Ignore all logfiles and tempfiles..project/*/.project.classpath/*/.classpath.settings/*/.settings/*/.settings/*target/*/target/*/target/*.DS_Store.svn.svn/*.idea.idea/*Thumbs.db*.log
Git and GitHub
Git client: http://msysgit.github.io/, using this client's SSH authentication method is as follows:
- Ssh-keygen-t rsa-C registered email
- C: \ Users \ Puma \. Ssh \ id_rsa.pub (if it is a MAC system, the directory is/users/PUMA/. Ssh) and the content is completely copied to the GIT server.
- Git clone [email protected]: Mall/mall. Git
Push to GitHub: http://railstutorial-china.org/chapter1.html#section-1-3-4
Note: you must first register a GitHub. com account. If you use SSH for pushing, you need to create an SSH key and create a repository in GitHub.
For example, if we have an account pumadong on GitHub and a project Cl-privilege is created below, we can:
Create a new repository on the command line
Touch readme. md
Git init
Git add readme. md
Git commit-M "first commit"
Git remote add origin [email protected]: pumadong/cl-privilege.git
Git push-u origin master
You can also:
Push an existing repository from the command line
Git remote add origin [email protected]: pumadong/cl-privilege-1.0.0.git
Git push-u origin master
Now we can see this master branch in GitHub:
Https://github.com/pumadong/cl-privilege
For git, there are GUI programs available under Windows and Mac. in Linux, it seems that only git commands are available.
If git is not identified when this project is opened in eclipse, you can delete the project and clone it once from GitHub: git clone [email protected]: pumadong/cl-privilege.git
Git and gitlab
GitHub is very expensive for private use. Gitlab is generally used within the company.
Http://www.gitlab.com/
Http://www.uloli.com/p/6sh26/