Detailed git entry level, from installation to actual combat

   

  Has its own cloud open source code website, you want to upload code to the cloud project how to operate? The new technology to enhance the company's Svn into Git, panic do not panic? Want to download from Github open source open source project web site, we are also dependent on direct download and unzip the project import project? The following can be simple and well understood, and the step of operating to pull we offer codes.

Under a windows install Git

 1, download the official Git address: https: //git-scm.com/download/win (installed by default download just fine)

  In practice, however, the official website download speed super slow, which also offers pheasant Download. https://www.newasp.net/soft/431610.html

 

 2. After the download is complete, it is a step by step installation, the default selection just fine

Two Gitlab, Github, Gitee (code cloud) to build a common development environment

1. After the installation is complete, need to git -version to see the version

2. If this is a new installation, direct the implementation of the fourth step , if it is before-configured environment, try to think of the next configuration environment, the implementation of the third step

3. Perform (lifting of the original binding relationship, and delete .ssh file) (usually in C: \ Users \ User \ .ssh)

1) git config --global --list inquire whether to set binding relationship

2) If you set a binding relationship, you need to execute the following statement released

 $ git config --global --unset user.name "你的名字" $ git config --global --unset user.email "你的邮箱"

4. Generate git keys (this is understood as a relationship key and a lock, you need to generate the key hole in the lock to open the appropriate platform for each of the key operations need to match)

  First Health City .ssh file, and then generate the following key

1) github generate the key

  ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "邮箱"

 ~ / .Ssh / id_rsa .github (which is named, personalized key) - C "mailbox" (login account mailbox)   

2)gitlab生成密钥

  ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitlab -C "邮箱" 

3)gitee生成密钥

  ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitee -C "[email protected]"

5. Because it is arranged to generate a variety of environments, need to configure a separate config file, if single platform, skip this step generates a key

1) generating a configuration file config

$ touch ~/.ssh/config 

2) By configuring each platform configuration files

1)$ touch ~/.sshHost github.com
    HostName github.com           #连接的服务器地址
    User git                      #默认就是git,可以不写
    IdentityFile ~/.ssh/id_rsa.github #文件中生成的密钥文件 #Add gitLab user Host git@gitlab.com HostName gitlab.com User git #默认的用户名 IdentityFile ~/.ssh/id_rsa.gitlab # gitee Host gitee.com Port 22 -------------------- 默认的端口配置,可以省略 HostName gitee.com User git IdentityFile ~/.ssh/id_rsa.gitee

3) arranged keys in different platforms

 First of all, the location to which the key (C: \ Users \ Xu Lidong)

 Secondly, each platform configured keys, such as gitee (cloud code) configured key ( It should be noted that the number of platform configuration for each key, may be a plurality )

 

 

 

 

 The platform github, the configuration key

6. Test results of each platform is connected, it is connected properly

 By executing the following command to check whether each platform is connected properly  

 -T SSH  [email protected]          ------------------------ The suffix life, can distinguish between different platforms

    ssh -T [email protected]

    ssh -T [email protected]

  Some common error, if a config file, may result in illegal characters, such as comments.

 If there is an error verification problem, that is the configuration file to see is not the key file, or configure the server address is correct.

 

 

 

 

Three yards cloud pulling codes upload command codes used

1. First create a new local file, as a warehouse file

2. Right-click the folder in the current git bash here

3. Locate the cloud project code path SSH option to copy

4. By git init initializes the local repository

The pull code cloud code to local repository Git clone   [email protected]: xutuo / conversion_widget.git

6. git status 查询本地变更记录

7.git stash 缓存本地文件避免拉取时候被覆盖(贮藏)

8.git pull --rebase 拉取最新的代码到本地

9.git stash pop 本地代码和新代码合并

10.git add test.txt 新增文件

11. git commit -m "备注提交"

12. git push origin master 上传到码云

13. git log 查询提交记录

 

 

参考文章:https://www.jianshu.com/p/68578d52470c

 https://www.cnblogs.com/zhedingbingqin/p/9691065.html

Guess you like

Origin www.cnblogs.com/puretuo/p/11863571.html