Transferred from: http://blog.chinaunix.net/uid-20718384-id-3334859.html
1. Installation
- sudo apt-get install Git-core
2. Initialize the Git repository (an existing project) such as Hello
- CD Hello
- Git init
- git add *
- Git commit-a-M "Hello project"
3. Git local clone repository
- Git Clone/path/to/hello
4. Git remote clone (using SSH)
- git clone [email Protected]:/path/to/hello
5. Modify the data and submit
- VI hello.c #modify the file
- Git commit-m "Add comment" #本地提交
- git push orgin master #提交到服务器
- Git pull Origin master #从服务器同步代码到本地
6. Common git commands
- git rm #删除文件
- git checkout Master #检出master代码
- git checkout-b testing Master #新建分支
- git merge #合并分支
- git help #查看git common commands
7. Git failed to push problem
Reference: http://blog.sunzy.org/?p=341
Workaround:
First, use Git–bare init when initializing the repository on the server;
The repository initialized with "Git Init" (known as Working repository) will generate 2 types of files: ". Git" Repository directory (record version history) and a copy of the actual project file. You can call this repository "working directory." The working directory is a directory containing the version history directory ". Git" and the source file. You can modify your source files in the working directory and use the "Git add" and "git Commit" commands for version management.
The repository initialized with "Git Init–bare" (known as bare repository) contains only the ". Git" directory (record version history) and does not contain a copy of the project source files. If you enter the version directory, you will find that there are only ". Git" directories, no other files. The repository contains only files that record the version history.
Second, if you are using GIT init, you need to modify the configuration (. git/config) on the server to add:
[Receive]
Denycurrentbranch = Ignor
Ubuntu git simple get Started "go"