How to Save Username and Password in Git

- Andrés Cruz

En español

Credential management in Git is crucial to facilitate the workflow and ensure the security of your repositories. In this guide, we'll explore how to save your Git username and password securely.

1. Initial Configuration

Before you begin, make sure you have Git installed on your system. Then, follow these steps:

  1. Set your Name and Email:
    • Open a terminal and run the following commands:

      git config --global "Your Name"
      git config --global ""
    • Replace “Your Name” and “” with your real information.
  2. Save your Credentials:
    • Run:

      git config --global credential.helper store
    • This will store your credentials in a file on your local drive.

2. Security Considerations

It is important to keep the following in mind:

  • Plain Text Storage: Credentials are saved in a plain text file on your computer. Make sure no one else has access to this file.
  • Safer Alternatives:
    • If you want a more secure solution, consider using SSH or personal access tokens instead of saving passwords in plain text.
    • You can configure Git to use OAuth authentication using Git Credential Manager.

3. Test and Document

  • Test your Configuration: Perform some Git operations (such as pull or push) to verify that your credentials are saved correctly.
  • Document your Changes: Add comments in your code or in a README file to explain how you set up your credentials. This will be useful for you and other developers working on the project.
Andrés Cruz

Desarrollo con Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz en Udemy

Acepto recibir anuncios de interes sobre este Blog.

!Cursos a!


En Udemy

Quedan 1 días!


!Cursos desde!


En Academia

Ver los cursos

!Libros desde!


Ver los libros
¡Hazte afiliado en Gumroad!
!Web Alojada en Hostinger!