Git Pull, pulls from the wrong repository.

Answered

When I perform a git pull from within IntelliJ the pull changes dialog correctly displays the Remote origin (sc-smdx) :-

However in the version control console you can see it pulling from a different repository (from an old project)

POST git-upload-pack (gzip 6000 to 3062 bytes)
warning: no common commits
remote: Counting objects: 1009, done[K
remote: Finding sources: 100% (7091/7091)[K
Receiving objects: 100% (7091/7091), 3.13 MiB | 5.49 MiB/s, done.
Resolving deltas: 100% (2246/2246), done.
remote: Total 7091 (delta 2246), reused 6927 (delta 2246)[K
From https://gerrit.sandbox.extranet.group/sc-webapi-docupload
* branch master -> FETCH_HEAD
+ a9cdc20...451ccab master -> origin/master (forced update)
error: Your local changes to the following files would be overwritten by merge:
smdx-service/src/main/java/com/lloydsbanking/smdx/process/content/ContentController.java
Please, commit your changes or stash them before you can merge.
Aborting

 

???

0
6 comments

IDE just calls git pull via external git client. Seems git is misconfigured.

Does executing the same command as IDE (you could see the exact command in the Console tab) in the command prompt pull from the correct repo?

What is the output of `git remots -vv` in the command prompt?

 

0
Avatar
Permanently deleted user

Hi Dmitriy, 

git pull from the command prompt works fine.

$ git remote -vv
origin https://chris.millburn@gerrit.sandbox.extranet.group/sc-smdx (fetch)
origin https://chris.millburn@gerrit.sandbox.extranet.group/sc-smdx (push)

(these are correct).

The question is where does IJ get this "From" repository..

Resolving deltas: 100% (2246/2246), done.
remote: Total 7091 (delta 2246), reused 6927 (delta 2246)[K
From https://gerrit.sandbox.extranet.group/sc-webapi-docupload
* branch master -> FETCH_HEAD
+ a9cdc20...451ccab master -> origin/master (forced update)

?

0

> The question is where does IJ get this "From" repository..

What is the command IJ issues? If there is no explicit URL there, it is not IJ, but git itself.

 

Have you tried executing exactly the same command as IDE does?

Are you trying with the same git executable, and same environment (GitBash is not the same as IDE uses, check in command prompt)

0
Avatar
Permanently deleted user

This is the output from the git console from within IJ

14:20:49.757: [sc-smdx] git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat -v --progress origin master
git: 'credential-cache' is not a git command. See 'git --help'.
git: 'credential-cache' is not a git command. See 'git --help'.
POST git-upload-pack (945 bytes)
POST git-upload-pack (945 bytes)
POST git-upload-pack (gzip 1745 to 935 bytes)
POST git-upload-pack (gzip 3345 to 1740 bytes)
POST git-upload-pack (gzip 6500 to 3311 bytes)
warning: no common commits
remote: Counting objects: 989, done[K
remote: Finding sources: 100% (7134/7134)[K
Receiving objects: 100% (7134/7134), 3.14 MiB | 2.94 MiB/s, done.
Resolving deltas: 100% (2263/2263), done.
remote: Total 7134 (delta 2263), reused 6971 (delta 2263)[K
From https://gerrit.sandbox.extranet.group/sc-webapi-docupload <<<<<<<<<<<<<<<<< Incorrect
* branch master -> FETCH_HEAD
+ 3bb6ee3...ae6d7f1 master -> origin/master (forced update)

Running exactly the same command at the bash shell.

$ git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat -v --progress origin master
From https://gerrit.sandbox.extranet.group/sc-smdx     <<<<<<<<<<<<<<<<<<<< Correct
* branch master -> FETCH_HEAD
+ ae6d7f1...3bb6ee3 master -> origin/master (forced update)
Already up-to-date.

 

Could they be running different instances of git ??

 

0

Check the path to git executable configured in the IDE - Settings | Version Control | Git.

Make sure it is the same you use on the command line.

Also, looks like you are running GitBash. Will anything change if you run the command in Command prompt, not GitBash?

0
Avatar
Permanently deleted user

Yes thats definitely the problem, if I go to a Windows command prompt and do a git push it uses the wrong repo.

Its definitely nothing to do with IntelliJ.

Thanks for your help 

0

Please sign in to leave a comment.