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
相关推荐
Hvitur11 小时前
Git - 多分支合并
git·github
考虑考虑14 小时前
git刷新远程分支列表
git·后端·gitlab
AI大模型-小华19 小时前
Codex 自动测试怎么用?从生成测试用例到修复失败用例
git·测试用例·ai编程·软件开发·codex·chatgpt pro·codex cli
七分辣度2 天前
GitHub/Git 常用命令及使用场景
git·github
慧都小项3 天前
MyEclipse Inline Diff 实用指南:逐处核对 AI 修改再提交
git·ai编程·myeclipse·java 代码审查·ai 代码修改
德育处主任3 天前
让 Claude Code 在你睡觉时接着干活:tmux、权限策略与验收清单
git·ai编程·命令行
为思念酝酿的痛5 天前
Git基本操作
git·github
wno7046 天前
常用的Git命令清单
大数据·git·elasticsearch
真上帝的左手6 天前
3. 代码管理-Git-进阶
git·源代码管理
YIN_尹7 天前
【git原理与使用】git基本操作及底层原理(二)
大数据·git·elasticsearch