How to Store Bitbucket App Password in Linux Using Git Credential Manager

How to Store Bitbucket App Password in Linux Using Git Credential Manager


Table of Contents


Introduction

Storing your Bitbucket app password securely in Linux can save you time and improve your workflow by allowing you to avoid entering your credentials every time you interact with your Bitbucket repositories. In this blog post, we will show you how to store your Bitbucket app password in Linux using the Git Credential Manager. We will assume that you already have Git installed on your system. If not, please follow the instructions in the first step below.

Step 1: Install Git (if not installed)

First, you need to ensure that Git is installed on your system. To install Git, open your terminal and run the following commands:

sudo apt-get update
sudo apt-get install git

This will update your package list and install Git on your system.

Step 2: Configure Git to use the Git Credential Manager

Once Git is installed, you need to configure it to use the Git Credential Manager. To do this, run the following command in your terminal:

git config --global credential.helper store

This command sets the Git credential helper to the Git Credential Manager Core, which will securely store your app password for future use.

Step 3: Manually create credentials file and add credentials (Optional)

You can also manually create the credentials file and add your Bitbucket app password to it. First, create the ~/.git-credentials file:

touch ~/.git-credentials

Next, open the ~/.git-credentials file with your preferred text editor, like nano, vim, or gedit:

nano ~/.git-credentials

Now, add your Bitbucket credentials to the file in the following format:

https://<username>:<app_password>@bitbucket.org

Replace with your Bitbucket username and <app_password> with your app password. Save the file and close the text editor.

Step 4: Store and manage Bitbucket app password

Now that Git is configured to use the Git Credential Manager, the next time you interact with a Bitbucket repository (e.g., clone, fetch, or push), the stored credentials will be used.

If you need to update or delete the stored credentials, you can do so by editing the ~/.git-credentials file, as shown in step 3. Be cautious when editing this file, as it contains sensitive information.

Conclusion

By following these steps, you can securely store your Bitbucket app password on your Linux system, making your interactions with your Bitbucket repositories more efficient. Remember to treat app passwords as sensitive information and be cautious when sharing or storing them. Consider using additional security measures, like encrypting the credentials file, to further protect your information.

© 2024 Virendra Giri