40

git コマンド ラインを使用して GitHub で署名付きタグを作成しようとしています。(サンプル) username で GPG キーを生成しましたFull Name (skytreader) <fullname@gmail.com>それが終わったら、署名付きタグを作成しようとします。ただし、次のエラーが表示されます。

gpg: skipped "full <fullname@gmail.com>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
error: unable to sign the tag

指定されたユーザー名で別のキーを作成するだけでよいと思います。しかし、「full」という名前を入力するgpgと、私の名前は少なくとも 5 文字の長さにする必要があると不平を言います。

このキーを git で使用するにはどうすればよいですか?

GPG でタグに署名するために git が使用するユーザー名を変更して、少なくとも 5 文字の長さの実名を取得する必要がありますか?

4

3 に答える 3

41

まず、ID の gpg キーがあるかどうかを確認する必要があります。

$ gpg --list-key

次のように表示される必要がある場合:

  1. パブ 2048R/6AB3587A 2013-05-23
  2. uid xxx (xxx の gpg)
  3. サブ 2048R/64CB327A 2013-05-23

gpg キーがない場合。作成する必要があります

$ gpg --gen-key

次に、この出力があります。

gpg (GnuPG) 2.0.14; Copyright (C) 2009 Free Software Foundation, Inc. これはフリー ソフトウェアです。変更や再配布は自由です。法律で許可されている範囲で、保証はありません。

必要なキーの種類を選択してください:

  1. (1) RSA と RSA (デフォルト)
  2. (2) DSAとエルガマル
  3. (3) DSA (署名のみ)
  4. (4) RSA (署名のみ)

あなたの選択?RSA キーの長さは 1024 ~ 4096 ビットです。どのキーサイズが必要ですか? (2048)
要求された鍵のサイズは 2048 ビット
です。鍵の有効期間を指定してください。

         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years

キーは有効ですか? (0)
キーの有効期限がまったくありません
。これは正しいですか? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: xxx
Email address: xxx@example.com
Comment: gpg for xxx

You selected this USER-ID:
    "xxx(gpg for xxx) <xxx@example.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

can't connect to `/xxx/.gnupg/S.gpg-agent': No such file or directory
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
于 2013-05-23T23:49:03.527 に答える
16

コミッター名は~/.gitconfigファイルにあります。そのエントリを実際の名前に変更します (これはとにかくコミットしたい方法です)。お気に入りのエディターでファイルを編集するか、次のように発行できます。

git config --global user.name "<name>"
于 2012-08-21T20:04:57.113 に答える