xpanta
xpanta

Reputation: 8418

PyCharm, git: Cannot Pull after remote repo name changing

I was using PyCharm with GitHub for some time. Then I had to rename the github project's name (from github.com/username/old-name to github.com/username/new-name). I had to do this because there was some issue with the previous name. Nothing else changed. Although I changed the name of the repo, I can succesfully push changes. I also noticed that when I type https://github.com/username/old-name, github redirects me to https://github.com/username/new-name.

Then my partner joined and added some new files. New files appear on Github, but PyCharm is unable to fetch and merge changes. In the Pull dialog it shows the url of the old-repo. And when I press 'OK' to pull new changes, it says that it cannot pull because:

"Your local changes to the following files would be overwritten by merge. Please, commit your changes or stash them before you can merge"

But I have commit changes to my local repo, already and the "following files" list is empty.

Does it relate to the name-change? If yes, what am I supposed to do now? If no, why PyCharm does not pull?

Upvotes: 6

Views: 3272

Answers (1)

VonC
VonC

Reputation: 1324188

Independently of your error, you could rename your origin url with:

git remote set-url origin https://github.com/username/new-name

Regarding your error message, you could stash your work in progress and pull: see "Ignoring “Your local changes to the following files would be overwritten by merge” on pull".

I have commit changes to my local repo

Then you could do a git pull --rebase (or selecting the rebase option on the PyCharm update dialog), in order to rebase your local new commits on top of what is being pulled.

Upvotes: 5

Related Questions