# One Git, Two Identities: How to Keep GitHub and Bitbucket From Mixing You Up

If you juggle personal projects on GitHub and company work on Bitbucket, you’ve probably run into this: You push your work code, and Bitbucket says —

> "This user cannot be matched to an Atlassian account."

Why? Because Git is still using your personal email and username from your GitHub setup. Good news: you don’t need two laptops or endless git config switches — you just need to tell Git which identity to use per repository.

## 🐞 The Problem

By default, Git uses your global config, meaning:

```bash
git config --global user.name "Your Personal Name" 

git config --global user.email "you@personal.com"
```

So, whether you’re in your weekend side project or your company’s Bitbucket repo, Git thinks you’re the same person.

That’s why Bitbucket can’t match your personal email to your Atlassian account.

## 🛠️ The Fix: Set Identity Per Repo

Let’s make Git smart enough to use work details for Bitbucket and personal details for GitHub.

1. Go to your Bitbucket project folder
    
    ```bash
     /path/to/bitbucket-project
    ```
    
2. Set work-specific details
    
    ```bash
    git config user.name "Your Work Name" 
    git config user.email "your-work-email@company.com"
    ```
    
    💡 This writes settings to the repo’s .git/config file — leaving your global GitHub settings untouched.
    
3. Check it worked
    
    ```bash
    git config user.name
    
    git config user.email
    ```
    
4. Should show your work identity inside the Bitbucket repo.
    

## 🎁 Bonus: Automate It

If you don’t want to remember to switch every time, tell Git to auto-load a config for all repos inside a certain folder.

Edit your global Git config:

```bash
git config --global --edit
```

Add:

```ini
[includeIf "gitdir:~/work-projects/"] 
    path = ~/.gitconfig-work
```

Then in ~/.gitconfig-work:

```ini
[user] 
    name = Your Work Name 
    email = your-work-email@company.com
```

Now, anything in `~/work-projects` will automatically use your work identity.

## 🚀 Final Push

With this setup:

* Personal projects → GitHub email & name
    
* Work projects → Bitbucket email & name
    
* No more “user cannot be matched” errors
    
* No risk of leaking personal details into work commits
    

💡 Tip: If you’re using SSH keys, you can also set separate keys for GitHub and Bitbucket so your push URLs never get mixed up.
