git自定义命令使用

1.Linux~/.bashrc内容

function custom_git {
    # 在 Windows 或 Unix 平台上设置 GIT_SSH_COMMAND
    export GIT_SSH_COMMAND="ssh -i $custom_ssh"
    git "$@"
}

# 设置 custom_ssh路径 
export custom_ssh="$HOME/.ssh/id_custom_sshkey"

2.Windows~/.bashrc内容

shell 复制代码
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi


function custom_git {
    # 在 Windows 或 Unix 平台上设置 GIT_SSH_COMMAND
    export GIT_SSH_COMMAND="ssh -i $custom_ssh"
    git "$@"
}

# 设置 custom_ssh 路径
export custom_ssh="$HOME/.ssh/custom_sshKey"

3.使用

custom_git status
相关推荐
GoppViper36 分钟前
golang学习笔记29——golang 中如何将 GitHub 最新提交的版本设置为 v1.0.0
笔记·git·后端·学习·golang·github·源代码管理
m0_464832362 小时前
Linux服务器上安装git lfs命令
git
贩卖纯净水.9 小时前
白月光git
git·github
爱吃瓜的猹z13 小时前
git reset 几点疑问
git·源代码管理
悟空201620 小时前
001、Git开发流程规范
git
Li小李同学Li20 小时前
git学习【持续更新中。。。】
git·学习·elasticsearch
晨春计21 小时前
【git】
android·linux·git
念幽1 天前
Git常用命令
git
神技圈子1 天前
【git系列】git中的那些迷惑的术语以及概念详解
git
benben0441 天前
Photoshop使用方法大全
git