git establishes a connection in Mac and remote repository

Source: Internet
Author: User

1. Download git

http://git-scm.com/download/

2. Install git

Follow the text prompts to

3. Verify the success, enter the command line

Git--version

4. Add your git account and email

git config--global user.name "xiqian.lxq"--global user.emall "[Email protected]"

5. Generate The secret key:

SSH xiqian$ ssh-keygen-t rsa-c "Macbookpro"

command required to enter a password, do not lose, three return.

After successful execution, two files are generated under the home directory. SSH path: Id_rsa private key file; id_rsa.pub public key file;

5. Add title and key to the remote repository Gitlab, consistent with local. Title is Macbookpro,key for content in Id_rsa.pub (copy all)

6. It is now possible to establish connections between local and remote warehouses. Several common commands

Your local repository consists of three "trees" maintained by git.

The first one is yours 工作目录 , it holds the actual document;

The second is 缓存区(Index) that it's like a cache area that temporarily saves your changes;

Finally HEAD , point to your results after the most recent commit.

    1. git clone "branch ssh path";
    2. git add *; Submit add file and modify file to buffer
    3. git add <filename>
    4. Git commit-m "code submission Information";//Commit changes to head

These are the commands for the local repository, then submit the remote repository:

    • Git push Origin master; Origin is the address of the remote repository, and master is any branch you want to push locally. Generally do not change

Get updates to the remote repository and position the command line to the current branch:

    • Git pull;

Resolve post-conflict merge changes:

    • git add <filename>

Before merging the changes, you can also use the following commands to view:

    • git diff <source_branch> <target_branch>

END

Git establishes a connection in your Mac and remote repository

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.