How To Fix Git Error An Item With The Same Key Has Already Been Added

When i push my local commits to remote repository use source tree, i get an error message which said An item with the same key has already been added like below picture.  After i read the error message carefully, i finally find the way to fix this error.

source tree git push error an item with the same key has already been added

Below is the detail error message.

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags origin master:master
fatal: ArgumentException encountered.
   An item with the same key has already been added.

fatal: ArgumentException encountered.
   An item with the same key has already been added.

Pushing to https://******abc-code.git
To https://*******-code.git
 ! [rejected]          master -> master (non-fast-forward)
error: failed to push some refs to 'https://******-code.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

1. Fix Git Error An Item With The Same Key Has Already Been Added Steps.

  1. Click Fetch icon menu in source tree to fetch the changes in remote repository which do not pulled to local machine.
  2. After that click Pull icon menu to pull remote repository changes to loacl machine.
  3. Now click Push icon menu to push local repository changes to remote repository. Now the error has disappeared.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.