Git配置

1.配置github

  1. 进入页面
  2. 点击New SSH key,输入Title,然后按照以下步骤生成key,并将key复制到网页中
  3. ssh-keygen -t rsa -b 4096 -C "你的邮箱"
  4. 回车三次
  5. cat ~/.ssh/id_rsa.pu,完整复制这些key,到网页中对应Title对应的key位置
  6. 回到git bash,运行 ssh -T git@github.com,看到以下提示表示成功
    在这里插入图片描述

2.配置git

git config --global user.name 你的英文名             #此英文名不需要跟GitHub账号保持一致
git config --global user.email 你的邮箱              #此邮箱不需要跟GitHub账号保持一致
git config --global push.default matchinggit config --global core.quotepath false
git config --global core.editor "vim"

git config --list #查看当前git的配置情况

3.获取git帮助手册

git help config
git commit -h # 获得add相关的帮助

平时在使用的过程中,如果忘记某个指令的参数,比如git commit,可以通过git commit -h添加-h来查看手册,里面会有详细的参数说明,就像Linux中的man手册一样,非常方便。

$ git commit -h
usage: git commit [<options>] [--] <pathspec>...

    -q, --quiet           suppress summary after successful commit
    -v, --verbose         show diff in commit message template

Commit message options
    -F, --file <file>     read message from file
    --author <author>     override author for commit
    --date <date>         override date for commit
    -m, --message <message>
                          commit message
    -c, --reedit-message <commit>
                          reuse and edit message from specified commit
    -C, --reuse-message <commit>
                          reuse message from specified commit
    --fixup [(amend|reword):]commit
                          use autosquash formatted message to fixup or amend/reword specified commit
    --squash <commit>     use autosquash formatted message to squash specified commit
    --reset-author        the commit is authored by me now (used with -C/-c/--amend)
    --trailer <trailer>   add custom trailer(s)
    -s, --signoff         add a Signed-off-by trailer
    -t, --template <file>
                          use specified template file
    -e, --edit            force edit of commit
    --cleanup <mode>      how to strip spaces and #comments from message
    --status              include status in commit message template
    -S, --gpg-sign[=<key-id>]
                          GPG sign commit

Commit contents options
    -a, --all             commit all changed files
    -i, --include         add specified files to index for commit
    --interactive         interactively add files
    -p, --patch           interactively add changes
    -o, --only            commit only specified files
    -n, --no-verify       bypass pre-commit and commit-msg hooks
    --dry-run             show what would be committed
    --short               show status concisely
    --branch              show branch information
    --ahead-behind        compute full ahead/behind values
    --porcelain           machine-readable output
    --long                show status in long format (default)
    -z, --null            terminate entries with NUL
    --amend               amend previous commit
    --no-post-rewrite     bypass post-rewrite hook
    -u, --untracked-files[=<mode>]
                          show untracked files, optional modes: all, normal, no. (Default: all)
    --pathspec-from-file <file>
                          read pathspec from file
    --pathspec-file-nul   with --pathspec-from-file, pathspec elements are separated with NUL character

4.参考资料

windows版的Git镜像:下载地址
参考官方文档:很详尽的官方文档,需要了解哪一部分,可以选择性地查阅。其中有Git内部原理
图解Git:稍微理解了Git的基本工作原理,这篇文章通过图形化让你理解的更加透彻。
Learning Git Branching:非常棒的动画教程,像玩游戏一样练习Git。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值