user1181445
user1181445

Reputation:

"Nothing to push" error in IntelliJ with Git

So I just installed and set up my first Git repo.

I came across that error while trying to push an update. What I tried to do:

  1. See an error - Fix it
  2. Click 'VCS' at the top
  3. Hover 'Git'
  4. Click 'Commit File...'
  5. Fill in comment. Make sure the file I changed in selected
  6. Click 'Commit and Push' at bottom of screen
  7. Hilight all the files I wish to push
  8. Click 'Push' at bottom of new screen

What is the issue here and what can I do to resolve it?

Upvotes: 10

Views: 6925

Answers (3)

AlpenDitrix
AlpenDitrix

Reputation: 320

When you push to an empty repository you must set on checkbox "Push current branch to alternative branch" and choose master as that alternative. It's because master is not created yet (repo is really empty). But doing this way you can pretend to initialize the repository.

While that checkbox is off and repository is empty, IDEA can't push, because its interface must be safe and he will not just create new brach if the one in which you pushed last accidentally disappeared (or just not exist). You must force that "branch creation"

UPD By the way currently latest IntelliJ versions can push to a nonexistent branches. Now it's shown just with adding prefix '+' to the name of branch in origin.

In the Push Commits dialog it looks like

bugfix/PML-239 -> origin:+bugfix/PML-239

Upvotes: 16

aragorrn
aragorrn

Reputation: 31

In my case, after setting up my remote repository, I simply made a fetch and then the push worked just fine.

Upvotes: 3

paka
paka

Reputation: 1641

I've resolved this with turning on checkbox "Push current branch to alternative branch". Not sure, but we need this for first push to new branch as it have status as 'untracked'.

Upvotes: 4

Related Questions