git

1.查看git是否安装好

$ git

a) 没安好

1 xcrun: error: active developer path ("/Applications/Xcode 6.1.1.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)

$ man xcode-select

$ xcode-select --install

b) 安装好

 1 usage: git [--version] [--help] [-C <path>] [-c name=value]
 2            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
 3            [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
 4            [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
 5            <command> [<args>]
 6 
 7 These are common Git commands used in various situations:
 8 
 9 start a working area (see also: git help tutorial)
10    clone      Clone a repository into a new directory
11    init       Create an empty Git repository or reinitialize an existing one
12 
13 work on the current change (see also: git help everyday)
14    add        Add file contents to the index
15    mv         Move or rename a file, a directory, or a symlink
16    reset      Reset current HEAD to the specified state
17    rm         Remove files from the working tree and from the index
18 
19 examine the history and state (see also: git help revisions)
20    bisect     Use binary search to find the commit that introduced a bug
21    grep       Print lines matching a pattern
22    log        Show commit logs
23    show       Show various types of objects
24    status     Show the working tree status
25 
26 grow, mark and tweak your common history
27    branch     List, create, or delete branches
28    checkout   Switch branches or restore working tree files
29    commit     Record changes to the repository
30    diff       Show changes between commits, commit and working tree, etc
31    merge      Join two or more development histories together
32    rebase     Forward-port local commits to the updated upstream head
33    tag        Create, list, delete or verify a tag object signed with GPG
34 
35 collaborate (see also: git help workflows)
36    fetch      Download objects and refs from another repository
37    pull       Fetch from and integrate with another repository or a local branch
38    push       Update remote refs along with associated objects
39 
40 'git help -a' and 'git help -g' list available subcommands and some
41 concept guides. See 'git help <command>' or 'git help <concept>'
42 to read about a specific subcommand or concept.

$ ls 列出目录

$ ls -al

$ git status

$ ls /usr/local/git/

$ ls /usr/local/bin/

2.生成ssh-key

$ git config --global user.name "yanweiping"

$ git config --global user.email "yanwp121@163.com"

$ ssh-keygen -t rsa -C "yanwp121@163.com"

 1  Generating public/private rsa key pair.
 2  Enter file in which to save the key (/Users/WeepYan/.ssh/id_rsa):
 3  Created directory '/Users/WeepYan/.ssh'.
 4  Enter passphrase (empty for no passphrase):
 5  Enter same passphrase again:
 6  Your identification has been saved in /Users/WeepYan/.ssh/id_rsa.
 7  Your public key has been saved in /Users/WeepYan/.ssh/id_rsa.pub.
 8  The key fingerprint is:
 9  SHA256:Zs1OMcRfpBcNxzF2GB2RGx1QbGB6ni3myj/BBcSG0s4 yanwp121@163.com
10  The key's randomart image is:
11  +---[RSA 2048]----+
12  |         .o +*X/X|
13  |         o.oo=+BB|
14  |          *ooo+ o|
15  |         o E+.oo |
16  |        S + .=.. |
17  |       o o  oo.  |
18  |          .  ..  |
19  |          . ..   |
20  |           o...  |
21  +----[SHA256]-----+

2.生成ssh-key

$ git config --global user.name "yanweiping"

$ git config --global user.email "yanwp121@163.com"

$ ssh-keygen -t rsa -C "yanwp121@163.com"

 1 Generating public/private rsa key pair.
 2 Enter file in which to save the key (/Users/WeepYan/.ssh/id_rsa): 
 3 /Users/WeepYan/.ssh/id_rsa already exists.
 4 Overwrite (y/n)? y
 5 Enter passphrase (empty for no passphrase): 
 6 Enter same passphrase again: 
 7 Your identification has been saved in /Users/WeepYan/.ssh/id_rsa.
 8 Your public key has been saved in /Users/WeepYan/.ssh/id_rsa.pub.
 9 The key fingerprint is:
10 SHA256:wYc/MPuP75eAsrvm9uQRxz74DTcjevVCsSW/b8jiFqk yanwp121@163.com
11 The key's randomart image is:
12 +---[RSA 2048]----+
13 |                 |
14 |       . .       |
15 |        * .      |
16 |         B .  o .|
17 |        S +.o. * |
18 |        ...*+ + .|
19 |         o=.=*++.|
20 |        +oE*+**+o|
21 |       +++=**o.oo|
22 +----[SHA256]-----+

$ cd .ssh/

$ ls

$ vim id_rsa.pub

$ :q

$ git clone ssh://git@host:port/*/ProjectName.git

时常一个人发呆,看到宁静的天空。
原文地址:https://www.cnblogs.com/pinweyshg/p/5415905.html