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.
- git clone "branch ssh path";
- git add *; Submit add file and modify file to buffer
- git add <filename>
- 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:
Resolve post-conflict merge changes:
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