切换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)"
相关推荐
CSDN官方博客14 小时前
GitHub Copilot 新手极速上手指南
github·copilot
用户57844292286219 小时前
GraphRAG 与 LightRAG
github
峰向AI19 小时前
别再花几万块搭 Agent 了,[微软开源] 3500 行框架让 AI 自己练级
github
解道Jdon1 天前
JDK 27发布:紧凑对象头、G1默认、量子安全TLS
ide·windows·git·svn·eclipse·github·visual studio
m4Rk_1 天前
【论文阅读】Agent 记忆机制(72):EMA——在写入前决定什么值得记住
论文阅读·人工智能·学习·开源·github
OpenTiny社区1 天前
从开发到运行:OpenTiny NEXT 如何构建 Agent 时代的 Web 应用?
前端·github·ai编程
政安晨1 天前
政安晨【超级AI智能体~技术简报】- Skills 元方法论霸榜 + Agent Harness 爆发 + 反直觉叙事的胜利
github·开源项目·ai agent·技术简报·政安晨
QUOR1 天前
ZorvAI APK 插件框架 · 技术架构与功能介绍
github·apk·编程语言
孙琦Ray1 天前
Homebrew/BrewUI:Homebrew 官方出的 macOS 图形客户端,把 brew 的装包、更新包变成点选
人工智能·开源·github
HelloGitHub1 天前
从一份 README 到 3 万星,RustFS 这一年都干了什么?
开源·github