切换github帐号

bash 复制代码
#!/bin/bash

# Get the current GitHub user
current_user=$(git config --global user.name)

if [ "$current_user" == "user1" ]; then
    # Switch to user2
    mv id_rsa id_rsa_user1
    mv id_rsa.pub id_rsa_user1.pub
    mv id_rsa_user2 id_rsa
    mv id_rsa_user2.pub id_rsa.pub

    # Configure Git for user2
    git config --global user.name "user2"
    git config --global user.email "user2@gmail.com"
    echo "Switched to user2"
else
    # Switch to user1
    mv id_rsa id_rsa_user2
    mv id_rsa.pub id_rsa_user2.pub
    mv id_rsa_user1 id_rsa  
    mv id_rsa_user1.pub id_rsa.pub

    # Configure Git for user1
    git config --global user.name "user1"
    git config --global user.email "user1@gmail.com"
    echo "Switched to user1"
fi

# Display the current user name and email
echo "Current GitHub user: $(git config --global user.name)"
echo "Current GitHub email: $(git config --global user.email)"
相关推荐
乱码三千1 小时前
Open Knowledge Framework 一套让智能体越用越好用的成长框架
架构·github
峰向AI17 小时前
学生党/打工人必备:AI自动把课程视频变成讲义
github
其实防守也摸鱼20 小时前
教育信息技术应用创新---基础软件信息赛
运维·服务器·数据库·github·copilot
0xR3lativ1ty1 天前
AI本地部署工具火热趋势
github
LlmCraft|大模型工程实践1 天前
14. CI/CD 流水线中集成 Docker:GitHub Actions 自动构建部署
ci/cd·docker·github
hulihutu441 天前
拒绝延期、bug、货不对板:2026 管理系统定制开发落地保障手册
github·bug·鸿蒙系统·数据库管理员
隔窗听雨眠1 天前
活动中台系统慢SQL治理实践:从监控告警到性能优化的全链路方法论
sql·性能优化·github
m4Rk_1 天前
【论文阅读】Agent 记忆机制(60):MemInsight——让 LLM 自动为历史记忆生成语义索引
论文阅读·人工智能·学习·开源·github
小弥儿1 天前
开源 VoiceStudio,声音克隆|配音|有声书一站式本地完成
学习·开源·github
问天_观心2 天前
大模型微调学习(一)
开发语言·人工智能·学习·语言模型·github