blog icon indicating copy to clipboard operation
blog copied to clipboard

Git 一些不常用的命令

Open penglongli opened this issue 7 years ago • 0 comments
trafficstars

1. 跟踪 git 的调用

$ GIT_TRACE=1 git clone XXXX

2. 仓库链接带入账号密码

$  git clone https://penglongli:密码@gitlab.com/penglongli/项目名称.git

3. 指定私钥

$ GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa" git clone XXXX

4. git config

$ git config --list
$ git config --list --global
$ git config --global --edit

5. 指定远程仓库 URL

$ git remote set-url origin XXXX

6. HTTP(S) 协议设置 cache

  • Linux
# 设置缓存
$ git config --global credential.helper cache
# 设置缓存过期时间
$ git config --global credential.helper 'cache --timeout=3600'
  • Win
$ git config --global credential.helper wincred
  • Mac Mac 有 keychain 记录密码,也可以手动设置 git

相关见:https://help.github.com/articles/caching-your-github-password-in-git/

penglongli avatar Jan 10 '18 12:01 penglongli