0

I was going to push my commits, but some error appeared and I'm lucky, bc as it shows I was going to push to the same commits (I think). I'm afraid that I'll broke something by pushing to double commits.

Why? Look at this:

[john@pc]$ git push
// useless stuff
Delta compression using up to 4 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (18/18), 2.63 KiB | 0 bytes/s, done.
Total 18 (delta 14), reused 0 (delta 0)

// here it goes
remote: Audit failure - Commit 3876b44 - Non-full name: johngitacc
remote: Audit failure - Commit 3876b44 - Non-full name: johngitacc
remote: Audit failure - Commit 6757f52 - Non-full name: johngitacc
remote: Audit failure - Commit 6757f52 - Non-full name: johngitacc

Why there 2x2 same commits: two of 3876b44 and two of 6757f52?
Can it be caused by the reason these commits was created in different local branches and then they were cherry-picked from that branches? AFAIK, no, bc I deleted these branches after cherry-picking, but "double-titles" still there. What can be the reason? Am I going to push the same commits?

P.S. I shortened the SHA-1s of commits for readability.

UPD.:

I ran git config user.name "John Pushandpop" command. Then git push and got the same output, but a little bit changed those 4 lines:

remote: Audit failure - Commit 3876b44 - Non-full name: John
remote: Audit failure - Commit 3876b44 - Non-full name: johngitacc
remote: Audit failure - Commit 6757f52 - Non-full name: John
remote: Audit failure - Commit 6757f52 - Non-full name: johngitacc
DilithiumMatrix
  • 17,795
  • 22
  • 77
  • 119
pushandpop
  • 455
  • 1
  • 10
  • 22
  • what `git status` shows? – Ostap Maliuvanchuk Nov 27 '15 at 15:19
  • Sounds like your server is expecting certain items of meta-data to come in a certain format with the commit or it won't allow you to push. The solution may be something like `git config user.name 'John Pushandpop'`. It seems to think that the formatting of your name is important – Mad Physicist Nov 27 '15 at 15:25
  • @OstapMaliuvanchuk, ```Your branch is ahead of 'origin/master' by 2 commits.``` – pushandpop Nov 27 '15 at 15:29
  • @MadPhysicist, I know that and I'll fix it, but before I wanna know whether I'm going to push 2 double commits. – pushandpop Nov 27 '15 at 15:29
  • 1
    I don't think there is such a thing as "double commit". Things with the same SHA1 are identical as far as git is concerned. The message you are seeing is output by the server-side auditing script, which is just printing a message multiple times for whatever reason (probably because you fail on multiple criteria for the same commit). – Mad Physicist Nov 27 '15 at 15:45
  • @MadPhysicist, ok, I got it. So, should I just set "full name" and try to push again? I'm concerned bc I can break repo for others since I have write access. – pushandpop Nov 27 '15 at 15:58
  • 1
    You can try push them to a new remote brunch and see what happens, if it's ok then push to master and delete the branch. – Ostap Maliuvanchuk Nov 27 '15 at 16:38
  • 2
    Yes, do what Ostap Bender says – Mad Physicist Nov 27 '15 at 16:39
  • @OstapMaliuvanchuk, well, setting ```user.name``` doesn't help. I've updated my question. – pushandpop Nov 27 '15 at 17:13
  • Set the name globally with `git config --global user.name "Your name"` – Ostap Maliuvanchuk Nov 27 '15 at 17:50
  • @OstapMaliuvanchuk, Yes, you're right. This is what it needs from me ;) Can you post it as answer, so I can mark it as accepted. – pushandpop Nov 27 '15 at 17:59

2 Answers2

1

You need to set your global user name with : git config --global user.name "Your name"

If you want to test what happens in case you push your commits to master you can just push them to new remote branch. But as @MadPhysicist said it should be OK.

Ostap Maliuvanchuk
  • 1,125
  • 2
  • 12
  • 32
0

There's no such thing as a duplicated commit - if it has the same hash, it's the same commit.

As they told you in the comments, it may be that the remote script is processing each commit twice because of an error or poor programming - who cares? As long as it detects the issue, it's not that relevant if it's informed twice.

But the other alternative that wasn't mentioned is you may be pushing two branches instead of one. Try doing git push origin master instead of just git push to see if this is the case.

If it is, you may want to change the push.default config to something like current so git push only pushes the current branch to it's remote counterpart.

Community
  • 1
  • 1
mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81