git使用前配置

1、git push origin <当前分支>:refs/for/<当前分支>,简化为git gpush

执行配置:

git config --global alias.gpush '!f() { : push ; r=$1; [[ -z $r ]] && r=origin; b=$2; t=$(awk "{ print \$2 }" $(git rev-parse --git-dir)/HEAD); t=${t#refs/heads/}; [[ -z $b ]] && b=$t; cmd="git push $r HEAD:refs/for/$b%topic=$t"; echo $cmd; echo; $cmd; }; f'

然后

设置:

git config —local remote.origin.push ‘refs/heads/:refs/for/‘

取消

git config —unset —local remote.origin.push

 

2、自动补全

curl -s http://svn.baidu.com/downloads/git-completion.bash >~/.git-completion.bash
source ~/.git-completion.bash

3、账号配置:

git config —global user.email liyanlei01@baidu.com (把liyanlei01badiu.com改为你的邮箱)
git config —global user.name liyanlei01 (把yangyang22改为你的账号)

4、秘钥配置:

ssh-keygen -t rsa # 一路回车选默认选项

之后creata或者clone一个仓库即可操作。

posted @ 2017-05-04 11:52  Walker-lyl  阅读(497)  评论(0编辑  收藏  举报