首页 > 代码库 > git安装配置

git安装配置

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "PingFang SC" } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 } p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff } p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px "PingFang SC"; color: #000000; background-color: #ffffff } span.s1 { font: 12.0px "PingFang SC" } span.s2 { font: 12.0px Helvetica } span.s3 { font: 12.0px "PingFang SC"; color: #000000 } span.s4 { background-color: #ffffff } span.s5 { font: 11.0px "PingFang SC"; background-color: #ffffff } span.s6 { font: 11.0px "PingFang SC" } span.s7 { } span.s8 { font: 11.0px Menlo } span.Apple-tab-span { white-space: pre }</style>

1、使用 brew 安装 git

  brew install git

2、配置 ssh

  ssh-kengen -t rsa -C “邮箱” (目的是两台机器之间传输不需要密码)

  /Users/xiaojie/.ssh/id_rsa 密钥保存路径

  Your identification has been saved in /Users/xiaojie/.ssh/id_rsa.

  Your public key has been saved in /Users/xiaojie/.ssh/id_rsa.pub.

  The key fingerprint is:

    SHA256:JPjf77MOsTF18zVqeYUop3X8W2PAYA5Ir0ZzGlyFT3s xiaojiez@37degree.com

    The key‘s randomart image is:

      +---[RSA 2048]----+

      |      ...oo+     |

      |     ...o.+.oo . |

      |    . .=.o+.*o*.o|

      |     ..o*  O E+++|

      |      .+S = .+ ++|

      |      .. . =. o +|

      |        . +    . |

      |           o.    |

      |           o=o   |

      +----[SHA256]-----+

  查看密钥文件:cd /Users/xiaojie/.ssh/id_rsa —下一步-> more id_rsa.pub

3、将密钥放到 gitlab 上

  profile settings —> SSH Keys —> Add SSH KEY

4、进行 git 代码的拉取

  git clone git项目的 SSH 地址

5、拉取成功之后,默认是 master分支。

git安装配置