I got a forced update after I run git pull --rebase
I can't reproduct my issue, this is my first time, but my colleague came across this issue several weeks ago. After I pushed my commit to git server without rejection. I run git pull --rebase, then I got a forced update, and my last commit is missing. I have asked a question on StackOverflow, there is more details about this issue: https://stackoverflow.com/questions/49164906/why-git-pull-rebase-results-a-forced-update I have no idea about this. I'm using Ubuntu 16.04.4 with Git 2.16.2, PyCharm IDE. Sincerely, Tian Zhen
Re: I lost my commit signature
Thank you all very much! -Schrödinger On Wed, Jun 15, 2016 at 3:07 PM, Michael J Gruber wrote: > Jeff King venit, vidit, dixit 15.06.2016 06:34: >> On Wed, Jun 15, 2016 at 12:27:15PM +0800, ZhenTian wrote: >> >>> I got two more lines from gpg -v during commit with -S: >>> ``` >>> gpg: writing to stdout >>> gpg: RSA/SHA1 signature from: "2EF2AD6E Tian Zhen " >>> ``` >>> >>> after I commit, I push it to remote, but someone had pushed before to >>> master branch, so I pull on master branch(`git pull --rebase`), then I >>> check my commit via `git log --show-signature`, there is no signature >>> in it, so I commit it with --ament and -S again, the signature is come >>> back. >>> >>> I haven't check signature before push, because I have checked four >>> commits before, every commit is fine. >>> >>> I don't know whether the `git pull` influenced signature or not. >> >> Ah, so the problem is probably that you had a signature _initially_, but >> that it did not survive the rebase. Which makes sense, as rebase would >> need to re-sign. It does not by default, but you can tell it to do so >> with "-S". Or you can set `commit.gpgsign`, which should sign in both >> cases. > > While it's clear that a rebase invalidates the signature, we could try > to be more helpful here, especially given the fact that (with our model) > you can't sign a commit afterwards any more. > > commit.gpgsign signs everything, but there should be a mode for > re-signing signed commits, or at least a warning that rebase dropped a > signature so that you can --amend -S the last commit. > > Michael -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: I lost my commit signature
Hi Michael and Peff, I got two more lines from gpg -v during commit with -S: ``` gpg: writing to stdout gpg: RSA/SHA1 signature from: "2EF2AD6E Tian Zhen " ``` after I commit, I push it to remote, but someone had pushed before to master branch, so I pull on master branch(`git pull --rebase`), then I check my commit via `git log --show-signature`, there is no signature in it, so I commit it with --ament and -S again, the signature is come back. I haven't check signature before push, because I have checked four commits before, every commit is fine. I don't know whether the `git pull` influenced signature or not. My signature is just like Schrodinger's cat, when I check it, it lost :) -Schrödinger On Tue, Jun 14, 2016 at 6:57 PM, Michael J Gruber wrote: > Jeff King venit, vidit, dixit 14.06.2016 11:41: >> On Tue, Jun 14, 2016 at 04:39:38PM +0800, ZhenTian wrote: >> >>> I want to set gpg -v to pgp.program, but if I set it, it can't call gpg: >>> ``` >>> error: cannot run gpg -v: No such file or directory >>> error: could not run gpg. >>> fatal: failed to write commit object >>> ``` >>> >>> I have tried set gpg.program value to `gpg|/tmp/log`, `/usr/bin/gpg >>> -v`, `gpg -v`, `"/usr/bin/gpg -v"` >>> >>> only after I set to `gpg` or `/usr/bin/gpg` without any argument, it will >>> work. >> >> Ah, right. Most of the time we run such programs as shell commands, but >> it looks like we do not. So you'd have to do something like: >> >> cat >/tmp/fake-gpg <<-\EOF >> #!/bin/sh >> gpg -v "$@" >> EOF >> chmod +x /tmp/fake-gpg >> git config gpg.program /tmp/fake-gpg >> >> -Peff >> > > The content of "gpg.program" is used as argv[0] when we build up various > commands to be run; we expect it to heed standard gpg options. > > On the other hand: > > git -c gpg.program=echo commit -S > > 'successfully' creates a commit that has > > gpgsig -bsau Michael J Gruber > > as the last header line. gpg.program=true fails (as does cat, unhappy > with the options), so apparently we do some error checking but not enough. > > Michael -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: I lost my commit signature
Thanks Peff, I have setup to gpg.program, if any progress I will reply. Over. Sincerely, 田震 On Tue, Jun 14, 2016 at 5:41 PM, Jeff King wrote: > On Tue, Jun 14, 2016 at 04:39:38PM +0800, ZhenTian wrote: > >> I want to set gpg -v to pgp.program, but if I set it, it can't call gpg: >> ``` >> error: cannot run gpg -v: No such file or directory >> error: could not run gpg. >> fatal: failed to write commit object >> ``` >> >> I have tried set gpg.program value to `gpg|/tmp/log`, `/usr/bin/gpg >> -v`, `gpg -v`, `"/usr/bin/gpg -v"` >> >> only after I set to `gpg` or `/usr/bin/gpg` without any argument, it will >> work. > > Ah, right. Most of the time we run such programs as shell commands, but > it looks like we do not. So you'd have to do something like: > > cat >/tmp/fake-gpg <<-\EOF > #!/bin/sh > gpg -v "$@" > EOF > chmod +x /tmp/fake-gpg > git config gpg.program /tmp/fake-gpg > > -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: I lost my commit signature
Hi Peff, I want to set gpg -v to pgp.program, but if I set it, it can't call gpg: ``` error: cannot run gpg -v: No such file or directory error: could not run gpg. fatal: failed to write commit object ``` I have tried set gpg.program value to `gpg|/tmp/log`, `/usr/bin/gpg -v`, `gpg -v`, `"/usr/bin/gpg -v"` only after I set to `gpg` or `/usr/bin/gpg` without any argument, it will work. Sincerely, 田震 On Tue, Jun 14, 2016 at 4:18 PM, Jeff King wrote: > On Tue, Jun 14, 2016 at 04:09:52PM +0800, ZhenTian wrote: > >> I have tested sign my work in another project, it works fine, I have >> committed five times, all commits are signed. >> >> I can't find encoded signature block in the output of "git cat-file >> commit HEAD", only these: >> ``` >> tree 17a572e349ce2fda47470951b5011b9c2f6533b7 >> parent 2c35701725d34325520acb9b45daf42f64adc536 >> author TianZhen 1465887785 +0800 >> committer TianZhen 1465887791 +0800 >> >> feat: mobile support free freight hint, closed #1417 >> ``` >> >> Some of my commits are signed, for example I have committed four times >> today, only first commit is signed. Is it possible some issue with >> gpg-agent? I can't find it via `ps -Af | grep gpg`. > > Possibly. If you set gpg.program "gpg -v", does it help? You could also > try setting it to "gpg | /tmp/log" to see what gpg is passing back to > git. > > -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: I lost my commit signature
Hi Peff, I commit via this command: gcs -nm "feat: mobile support free freight hint, closed #1417" gcs is an alias in zsh, which is: git commit -S I have tested sign my work in another project, it works fine, I have committed five times, all commits are signed. I can't find encoded signature block in the output of "git cat-file commit HEAD", only these: ``` tree 17a572e349ce2fda47470951b5011b9c2f6533b7 parent 2c35701725d34325520acb9b45daf42f64adc536 author TianZhen 1465887785 +0800 committer TianZhen 1465887791 +0800 feat: mobile support free freight hint, closed #1417 ``` Some of my commits are signed, for example I have committed four times today, only first commit is signed. Is it possible some issue with gpg-agent? I can't find it via `ps -Af | grep gpg`. -Dawncold Sincerely, 田震 On Tue, Jun 14, 2016 at 3:58 PM, Jeff King wrote: > On Tue, Jun 14, 2016 at 03:50:43PM +0800, ZhenTian wrote: > >> I commit with -S argument, and I got some output like this: >> >> You need a passphrase to unlock the secret key for >> user: "Tian Zhen " >> 4096-bit RSA key, ID 2EF2AD6E, created 2016-05-21 >> >> [master d107770] feat: mobile support free freight hint, closed #1417 >> 8 files changed, 58 insertions(+), 29 deletions(-) >> rewrite static/css/mobile.min.css (64%) >> >> but when I check git log with --show-signature, I can't find my sign. >> >> my git is 2.4.8, and OS is Ubuntu 14.04.4 > > Here's a reproduction which should work (and does for me): > > $ git init > $ echo content >file > $ git add file > $ git commit -m foo -S > You need a passphrase to unlock the secret key for > user: "Jeff King " > 4096-bit RSA key, ID F9430ED9, created 2016-02-03 (main key ID D7B337A8) > > [master (root-commit) 6b0b230] foo >1 file changed, 1 insertion(+) >create mode 100644 file > > $ git log --show-signature > commit 6b0b230c79f8912bf8b21afc0d12d2cbf54cc74d (HEAD -> master) > gpg: Signature made Tue 14 Jun 2016 03:55:11 AM EDT using RSA key ID > F9430ED9 > gpg: Good signature from "Jeff King " > gpg: aka "Jeff King " > Author: Jeff King > Date: Tue Jun 14 03:55:11 2016 -0400 > > foo > > Does something similar work for you? If so, then we need to figure out > what happened in your original case. Can you show the exact commands you > ran, and what they did output? > > If the simple case above doesn't work, then we need to figure out > whether the commit doesn't get a signature, or whether "log > --show-signature" is not working on your system. For the former, I'd try > "git cat-file commit HEAD", which should show the encoded signature > block. If it's there, then presumably something is not working in > calling gpg. > > -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
I lost my commit signature
Hi git developers, I commit with -S argument, and I got some output like this: You need a passphrase to unlock the secret key for user: "Tian Zhen " 4096-bit RSA key, ID 2EF2AD6E, created 2016-05-21 [master d107770] feat: mobile support free freight hint, closed #1417 8 files changed, 58 insertions(+), 29 deletions(-) rewrite static/css/mobile.min.css (64%) but when I check git log with --show-signature, I can't find my sign. my git is 2.4.8, and OS is Ubuntu 14.04.4 Sincerely, dawncold -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html