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
相关推荐
bigHead-1 小时前
Git 修改远程仓库地址的几种方法
git
杀手不太冷!2 小时前
Jenkins的安装与使用;git clone url的时候,url为http和ssh时候的区别
git·http·jenkins
qq_229058013 小时前
GIT使用方法
git
YMGogre3 小时前
Git 多人协作开发
git
凯子坚持 c13 小时前
Git 多人协作深度解析:从工作流模拟到仓库维护
git
要站在顶端15 小时前
克隆大型仓库卡住(7%每次就卡住了)
git
五月底_16 小时前
上传大量文件到github repo
git·github
rannn_1111 天前
【Git教程】概述、常用命令、Git-IDEA集成
java·git·后端·intellij-idea
春日见1 天前
虚拟机上由于网络问题无法正常git clone
linux·服务器·网络·人工智能·git·ubuntu·debug
冉佳驹1 天前
Linux ——— Git的核心操作流程、进程状态及环境变量相关知识
linux·git·进程·环境变量·进程状态·fork