Git installation, configuration, using substantially

Code upload and install Git

A, Git download and install

1. Click Git , and then choose to download the installation package

Mac Download: https://git-scm.com/download/mac

Windows Download: https://git-scm.com/download/win

2、git  --version

If the output version, then the installation was successful.

 For example: git version 2.20.1

Two, git SSH key generation and the basic configuration

1、SSH key

method one,

 -C keygen -t-RSA SSH [email protected] (main registered mail)

E-mail can be true or false, name and email wrapped with double quotes, after a carriage return, as there is no change in path description set successfully;

Method Two,

a、git config --global user.name "your_name"

 

Name and email wrapped with double quotes, after a carriage return, as there is no change in path description set successfully;

 

b、git config --global user.email "[email protected]"

 

Mail account here may be a fake account, but must form a composite-mail format, the path will not change after the same carriage return success;

Method three,

a, enter the command: ssh-keygen -t rsa

Press ENTER consecutive times, i.e. locally generated private key and public key, a password is not set, the public and private key generated at ~ / .ssh directory, id_rsa private key, d_rsa.pub is the public key

2. If you already have SSH KEY, required? Backup

a, check SSH key

     Open the terminal and run cd ~ / .ssh

If a file representatives ssh key, the second step needs to be backed up

b, backup existing key, (if any)

     mkdir key_backup

     mv id_rsa* key_backup

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/jiangbo/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in yes.

Your public key has been saved in id_rsa.pub.

The key fingerprint is:

fb:c4:b0:e0:47:fd:be:e0:fb:ea:73:ef:a8:29:d5:22 [email protected]

The key's randomart image is:

+ - [RS 2048] ---- +

|                 |

|                 |

|                 |

|         .       |

|      . S ..     |

| . you are .. = |

| . A + .. + |

|       ..+.+..   |

| OOB = + or |

+-----------------+

3, SSH Key Use

1, the SSH key added to the coding

a, open a terminal, an input open ~ / .ssh, open view and copy the file id_rsa.pub all key value

b, open coding official website, the login is successful, click on the value of the account -SSH public key, enter copy

c, adding key value

d, click Submit

 

Three , use

1, the establishment of local warehouses and initialization

a, new desktop folder, right-click the "New Terminal window located in the folder location", open a command line

2、仓库初始化

git init

3、将项目克隆到本地仓库

git clone URL(项目的SSH地址)

4、更新远程更新到本地

先打开本地仓库的目录,要是程序文件夹的目录

然后输入更新代码命令,如下所示:

git pull 

5、提交代码

git add .

git commit -m “描述”

git push origin master




Guess you like

Origin www.cnblogs.com/zi-yangguang/p/11870903.html