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
相关推荐
cen__y7 小时前
Linux12(Git01)
linux·运维·服务器·c语言·开发语言·git
bukeyiwanshui10 小时前
20260518 Swift实验
git·swift
qziovv10 小时前
Git 回退场景
大数据·git·elasticsearch
来自大山深处的Doge_12 小时前
解决Git提交更新更改时出错: detected dubious ownership in repository at ...
git
嵌入式爱好者hsw15 小时前
Git 部署本地仓库
git
C137的本贾尼16 小时前
Git基本操作(三):版本回退,坐上“时光机”
git
ylifs17 小时前
目的驱动式Git用法
git
来尔君17 小时前
Git Bash 提示符简化(就是每次敲命令时上面显示的那一行信息)
git·命令行
我叫张小白。18 小时前
PyCharm 集成 Git 与 Gitee
git·pycharm·gitee
小雨青年18 小时前
Git Bisect 实战:用二分法快速找到引入 Bug 的提交
git·bug