Re: I lost my commit signature
Michael J Gruber writes: > Junio C Hamano venit, vidit, dixit 16.06.2016 19:06: > >> I am not so imaginative, either. One remotely plausible use case may >> be a project that has two classes of paths (let's call these classes >> sensitive and others), and requires its participants to sign commits >> that touch sensitive paths. The user needs something finter grained >> than per-project commit.gpgSign there. >> ... >> So, I dunno, either. > > While I follow both of your lines of argumentation, I tend to claim that > they imply: there is no reason to blindly sign any commit... We should > dump that config :) ... no reason to blindly sign any commit IN SUCH A PROJECT that wants you to selectively sign commits. That does not lead to "we should dump that config" that all, does it? -- 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
Junio C Hamano venit, vidit, dixit 16.06.2016 19:06: > Jeff King writes: > >> But why does somebody run "commit -S" for a single commit, but not all >> the time? Is it because that commit is special? Or is that particular >> moment special? One implies that it's important for the signature to be >> retained during a rebase, and one does not. >> >> So I dunno. I would not be opposed to such a feature, but I'm having >> trouble figuring out why it would be useful (though for the most part, I >> do not see why anything but per-project commit.gpgSign config is >> particularly useful. Maybe I just lack imagination). > > I am not so imaginative, either. One remotely plausible use case may > be a project that has two classes of paths (let's call these classes > sensitive and others), and requires its participants to sign commits > that touch sensitive paths. The user needs something finter grained > than per-project commit.gpgSign there. > > But even in such a case, the fact that an original commit is with a > signature should not be a good indication that the rewritten version > of that commit in the new history still touches the sensitive paths > that required the original to be signed (i.e. the history the user > is rebasing onto may already have the necessary changes to these > paths). > > So, I dunno, either. > While I follow both of your lines of argumentation, I tend to claim that they imply: there is no reason to blindly sign any commit... We should dump that config :) Since it's not possible to sign commits after the fact without rebasing (they are not "notes" attached to a commit but part of the commit) it is very conceivable to me that you build up your work with fine-grained commits and then, at some point where everything is ready and carefully inspected, you sign it. There are various possible reasons why you may not be able to rebase at that point. (I don't know why one wouldn't want to use signed tags here, but I never understood the need for signed commits in the first place.) I guess users of signed commits with rebase should speak up so that we can serve them well. 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
Jeff King writes: > But why does somebody run "commit -S" for a single commit, but not all > the time? Is it because that commit is special? Or is that particular > moment special? One implies that it's important for the signature to be > retained during a rebase, and one does not. > > So I dunno. I would not be opposed to such a feature, but I'm having > trouble figuring out why it would be useful (though for the most part, I > do not see why anything but per-project commit.gpgSign config is > particularly useful. Maybe I just lack imagination). I am not so imaginative, either. One remotely plausible use case may be a project that has two classes of paths (let's call these classes sensitive and others), and requires its participants to sign commits that touch sensitive paths. The user needs something finter grained than per-project commit.gpgSign there. But even in such a case, the fact that an original commit is with a signature should not be a good indication that the rewritten version of that commit in the new history still touches the sensitive paths that required the original to be signed (i.e. the history the user is rebasing onto may already have the necessary changes to these paths). So, I dunno, either. -- 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
On Wed, Jun 15, 2016 at 09:07:16AM +0200, Michael J Gruber wrote: > > 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. I had a similar thought, though I'm not sure how useful a "re-sign signed commits" mode would be in practice. Mostly because I'm not sure why signing would be more important for one commit versus another. That is, I can see why somebody would set "commit.gpgSign"; their preference (or that of their project) is to sign commits, and they've set up gpg, etc, to make it relatively painless. But why does somebody run "commit -S" for a single commit, but not all the time? Is it because that commit is special? Or is that particular moment special? One implies that it's important for the signature to be retained during a rebase, and one does not. So I dunno. I would not be opposed to such a feature, but I'm having trouble figuring out why it would be useful (though for the most part, I do not see why anything but per-project commit.gpgSign config is particularly useful. Maybe I just lack imagination). -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
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
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
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. -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 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
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
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
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
Re: I lost my commit signature
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