Score:1

Remote rejected

pa flag

I have the error "Remote rejected (Working directory has unstaged changes)". The error happens when I want to push my first changes, after cloning the repository. Please note that we have other repositories on the same platform and I can make changes without problem.

The error persist with an specific repository.

The steps I am doing are:

  1.  Git clone [URL]
    
  2.  Make changes (add file)
    
  3.  Git add .
    
  4.  Git commit –m “message”
    
  5.  Git push origin master
    
  6.  Add password
    
  7.  The password is accepted, but the following error appears:
    

! [remote rejected] master -> master (Working directory has unstaged changes) error: failed to push some refs to [URL repository]

Thank you in advance for your help.

Regards,

Score:1
sa flag

You have uncommitted changes locally, stash them first.

git stash

After you've pushed, get your stashed changes back

git stash pop
Corina avatar
pa flag
Although I have done commit and then git statsh I get the following message: "No local changes to save"
MikeSchem avatar
sa flag
what comes up when you do a `git status`?
Corina avatar
pa flag
On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean
MikeSchem avatar
sa flag
and `git push` doesn't work now?
Corina avatar
pa flag
I finally solved the problem. There was difference between the files on the server and my local one. So, I did git reset --hard HEAD, then cloned the repo, made changes and push again. Everything is fine now. :) Thanks @MikeSchem
MikeSchem avatar
sa flag
glad you got it working @Corina
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.