Modifying Git configuration file

Modifying .gitconfig file for Windows

  • Search and open Notepad as an administrator.

  • In the Notepad, click on File > Open.

  • Navigate to the folder where you have installed Git. (In my case C: > Program Files > Git > etc > gitconfig)

  • Note: If you are not able to see gitconfig, choose All Files. You will be able to see gitconfig.

  • Click and open the file gitconfig in the Notepad.

  • Add the following section to your .gitconfig file:

[credential "https://git-codecommit.*.amazonaws.com"]

    helper = !aws codecommit credential-helper [email protected] 

    UseHttpPath = true

  • Save the file, and close the Notepad.

By following the above steps, you will be able to prevent the errors while performing the lab.

Error: Fatal: unable to access ‘https://git-codecommit.us-east-1.amazonaws.com/v1/repos/whiz_repo’: The requested URL returned error: 403

 

Modifying .gitconfig file for MacOS

  • Navigate to the Git folder installed in your local machine. (In my case usr > local > git)
  • In Terminal, run the following command to edit Git configuration file

    • nano /usr/local/git/etc/gitconfig

  • Scroll down to find [credential].

  • Comment out or delete the credential section that contains helper = osxkeychain. For example:

    • sudo -s

    • # helper = osxkeychain

  • Once you have edited the gitconfig file, save it by using ^x(control+x) and enter y and press Enter to confirm the changes.

  • Exit from the Root user and close the terminal.

Configuring the Keychain Access utility:

If you are using macOS, after you connect to a CodeCommit repository with HTTPS for the first time, subsequent access fails after about 15 minutes. The default Git version on macOS uses the Keychain Access utility to store credentials. For security measures, the password generated for access to your CodeCommit repository is temporary, so the credentials stored in the keychain stop working after about 15 minutes. To prevent these expired credentials from being used, follow the steps:

  • Navigate to Launchpad and search for the Keychain Access utility.

  • Search for CodeCommit, you will get the keychain item with name git-codecommit.us-east-1.amazonaws.com

  • Right click on the item and select Get Info.

  • Choose the Access Control tab.

  • In Confirm before allowing access, choose git-credential-osxkeychain, and then choose the minus sign to remove it from the list.

  • Click on Save changes.

By following the above steps, you will be able to prevent the errors while performing the lab.

Error: Fatal: unable to access ‘https://git-codecommit.us-east-1.amazonaws.com/v1/repos/whiz_repo’: The requested URL returned error: 403