Eddie昌的博客 Eddie昌的博客
首页
  • 数据理论

    • 《数据仓库工具箱》
    • 《阿里巴巴大数据之路》
    • 《DAMA数据治理》
  • 数据实践

    • TypeScript
  • 数据分析1
  • 数据分析2
  • Hadoop生态
  • Linux
  • Git
  • 爱SQL
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 分类
  • 标签
  • 归档

Eddie昌

数据领域小学生
首页
  • 数据理论

    • 《数据仓库工具箱》
    • 《阿里巴巴大数据之路》
    • 《DAMA数据治理》
  • 数据实践

    • TypeScript
  • 数据分析1
  • 数据分析2
  • Hadoop生态
  • Linux
  • Git
  • 爱SQL
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 分类
  • 标签
  • 归档
  • Hadoop生态

  • Linux

  • Git

    • git设置用户邮箱并关联github账号
      • 一、登陆网页版GitHub查看注册名跟邮箱地址
      • 二、git本地设置用户名及邮箱
      • 三、生成ssh key
      • 四、ssh公钥配置到GitHub上
      • 五、测试是否正常
      • 六、使用cloc软件统计git仓库代码行数
  • 爱SQL

  • 技术
  • Git
Eddie昌
2023-12-25
目录

git设置用户邮箱并关联github账号原创

# git设置用户邮箱并关联github账号

# 一、登陆网页版GitHub查看注册名跟邮箱地址

1.点击右上角的用户图标

在这里插入图片描述

出现以下内容: 在这里插入图片描述

找到了用户名跟密码。

# 二、git本地设置用户名及邮箱

有几种模式,根据自己实际需要设置

  1. 全局模式,所有git仓库都用同一个用户及邮箱,修改的话同样命令修改内容即可

    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
    
    1
    2
  2. 不同项目设置不同用户及邮箱,要到git项目的根目录下。修改的话同样命令修改内容即可

    git config user.name "Your Name"
    git config user.email "your.email@example.com"
    
    1
    2
  3. 查看已设置的用户名和邮箱

    git config user.name
    git config user.email
    
    1
    2
  4. 使用多个身份信息

    在某些情况下,你可能需要在同一个项目中使用多个身份信息,例如在公司和个人项目之间切换。为了实现这一点,你可以使用Git的身份切换功能。可以在项目的根目录下创建一个特定的配置文件,并在该文件中设置用户名和邮箱。然后,在需要切换身份时,可以使用以下命令来指定使用哪个配置文件:

    #制定身份配置文件
    git config --local include.path /path/to/another/config/file
    
    1
    2

# 三、生成ssh key

ssh-keygen
# 一直回车即可
cat ~/.ssh/id_rsa.pub 
#把出现的一大串内容拷贝到GitHub上
1
2
3
4

# 四、ssh公钥配置到GitHub上

按以下截图进行即可: 在这里插入图片描述 在这里插入图片描述

# 五、测试是否正常

  1. 克隆一个个人私有库测试:

    git clone git@github.com:<你的用户名>/flink-web.git
    
    1

    克隆一个公共库测试:

  2. git clone git@github.com:apache/flink-web.git
    
    1

# 六、使用cloc软件统计git仓库代码行数

  1. 安装cloc软件

    sudo apt install cloc
    
    1
  2. 新建一个cloc-git.sh脚本统计

    #!/usr/bin/env bash
    git clone --depth 1 "$1" temp-linecount-repo &&
      printf "('temp-linecount-repo' will be deleted automatically)\n\n\n" &&
      cloc temp-linecount-repo &&
      rm -rf temp-linecount-repo
    
    1
    2
    3
    4
    5
    #增加执行权限
    chmod +x cloc-git.sh
    
    1
    2

    输入以下命令统计

    $ cloc-git https://github.com/evalEmpire/perl5i.git
    Cloning into 'temp-linecount-repo'...
    remote: Counting objects: 200, done.
    remote: Compressing objects: 100% (182/182), done.
    remote: Total 200 (delta 13), reused 158 (delta 9), pack-reused 0
    Receiving objects: 100% (200/200), 296.52 KiB | 110.00 KiB/s, done.
    Resolving deltas: 100% (13/13), done.
    Checking connectivity... done.
    ('temp-linecount-repo' will be deleted automatically)
    
    
         171 text files.
         166 unique files.                                          
          17 files ignored.
    
    http://cloc.sourceforge.net v 1.62  T=1.13 s (134.1 files/s, 9764.6 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Perl                           149           2795           1425           6382
    JSON                             1              0              0            270
    YAML                             2              0              0            198
    -------------------------------------------------------------------------------
    SUM:                           152           2795           1425           6850
    -------------------------------------------------------------------------------
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
  3. 或者手动统计

    $ git clone --depth 1 https://github.com/evalEmpire/perl5i.git
    $ cloc perl5i
    $ rm -rf perl5i
    
    1
    2
    3
#Git
Dockerfile配置centos安装sshd服务
连续登录问题

← Dockerfile配置centos安装sshd服务 连续登录问题→

最近更新
01
06.搭建一套源生hadoop、Spark、Flink集群3-Hive安装 原创
04-26
02
搭建一套源生Hadoop、Spark、Flink集群1-环境准备 原创
04-25
03
搭建一套源生hadoop、Spark、Flink集群2-Hadoop安装 原创
04-25
更多文章>
Theme by Vdoing | Copyright © 2019-2024 Evan Xu | MIT License | 粤ICP备2023070487号-1 | 粤公网安备44200102445447
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式