git 配置

git 配置信息以及git 别名,例如 使用co来简写checkout。

在~目录下编辑.gitconfig文件,内容信息如下。

 

[user]
	name = wangxinli
	email = wangxinli@derbysoft.com
[core]
	autocrlf = input
[push]
	default = simple
[http]
	sslVerify = false
[alias]  
  co = checkout  
  ci = commit  
  st = status  
  sh = stash  
  sa = stash apply  
  sp = stash pop  
  ap = add -p  
  br = branch  
  cp = checkout -p  
  cv = commit -v  
  dc = diff --cached  
  d = diff  
  pr = pull --rebase  
  ps = push  
  l = log --graph --pretty=format:'%C(yellow)%h%Creset %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short --all  
  lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all  

在平常的工作中,如果想避免每次提交都输入帐号和凭证信息,可以使用如下的命令

cd ~
touch .git-credentials
vim .git-credentials

在vim中输入如下的信息

https://{username}:{password}@github.com

请将username和password替换为你的帐号信息。

然后在命令行中输入

git config --global credential.helper store

再次打开 ~/.gitconfig文件,会发现多了一行

[credential]
	helper = store

然后就可以愉快的做开发工作了。

转载于:https://my.oschina.net/itwangxinli/blog/1525553

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值