Ubuntu git simple get Started "go"

Source: Internet
Author: User
Tags using git git clone git commands

Transferred from: http://blog.chinaunix.net/uid-20718384-id-3334859.html

1. Installation

    1. sudo apt-get install Git-core

2. Initialize the Git repository (an existing project) such as Hello

    1. CD Hello
    2. Git init
    3. git add *
    4. Git commit-a-M "Hello project"


3. Git local clone repository

    1. Git Clone/path/to/hello

4. Git remote clone (using SSH)

    1. git clone [email Protected]:/path/to/hello

5. Modify the data and submit

    1. VI hello.c #modify the file
    2. Git commit-m "Add comment" #本地提交
    3. git push orgin master #提交到服务器
    4. Git pull Origin master #从服务器同步代码到本地

6. Common git commands

    1. git rm #删除文件
    2. git checkout Master #检出master代码
    3. git checkout-b testing Master #新建分支
    4. git merge #合并分支
    5. 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"

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.