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

When I push my local commits to the remote repository use the Sourcetree, I get an error message which said An item with the same key has already been added.  After I read the error message carefully, I finally find a way to fix this error.

1. Below Is The Detailed 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 the Fetch icon menu in the Sourcetree to fetch the changes in the remote repository which do not pull to the local machine.
  2. After that click the Pull icon menu to pull remote repository changes to the local machine.
  3. Now click the Push icon menu to push local repository changes to the remote repository. Now the error has disappeared.
0 0 votes
Article Rating
Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x