Git, Misc

不用每次输入账号和密码的方法

git config credential.helper store
git push https://github.com/repo.git

Username for ‘https://github.com‘:
Password for ‘https://USERNAME@github.com‘:

这样的话只需要第一次输入密码,后面就会记住了。 但是它有个致命的缺点,

This answer is missing a warning about the store credential helper storing the password on disk unencrypted.


对单个 repo 设置 user.name 和 user.emailaddress

如果有很多个 github 账号, 可以对本地不同的 repo 设置不同的 github account

下面这样是 global 的设置

git config –global user.name “Mona Lisa”

去掉 –global,只对本地有效

git config user.name “Mona Lisa”


如何把 branch name 放在 bash prompt 前面

在 ~/.bash_profile 里写入

parse_git_branch() {
git branch 2> /dev/null | sed -e ‘/^[^]/d’ -e ‘s/ (.*)/ (\1)/’
}
export PS1=”\u@\h [\033[32m]\w[\033[33m]$(parse_git_branch)[\033[00m] $ “

source 后就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值