https://github.com/dabutvin/pgp-commit
PGP signing of commits with openpgp and nodegit
https://github.com/dabutvin/pgp-commit
git gpg nodegit openpgp pgp-signing
Last synced: 5 months ago
JSON representation
PGP signing of commits with openpgp and nodegit
- Host: GitHub
- URL: https://github.com/dabutvin/pgp-commit
- Owner: dabutvin
- License: mit
- Created: 2018-12-14T18:11:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T19:22:32.000Z (almost 5 years ago)
- Last Synced: 2025-04-13T22:09:34.593Z (10 months ago)
- Topics: git, gpg, nodegit, openpgp, pgp-signing
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/pgp-commit
- Size: 28.3 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PGP Commit
Sign a commit with openpgp and nodegit
- https://github.com/nodegit/nodegit
- https://github.com/openpgpjs/openpgpjs
## Install
```
npm install pgp-commit
```
## Example
See more examples in examples folder
```js
const git = require('nodegit')
const pgpCommit = require('pgp-commit')
run()
async function run() {
// clone a repo
const repo = await git.Clone('https://github.com/owner/repo', '/temp/repo')
const commitMessage = 'add data to something'
const author = git.Signature.now('test', 'test@test.com')
const committer = git.Signature.now('test', 'test@test.com')
// make a change
fs.writeFileSync('/temp/repo/nothing', 'nothing')
// stage the change
const index = await repo.refreshIndex()
await index.addAll()
await index.write()
// make a signed commit
const commitId = await pgpCommit({
repo,
commitMessage,
author,
committer,
passphrase,
privateKey
})
}
```
## Add your public GPG key to github
see https://help.github.com/articles/adding-a-new-gpg-key-to-your-github-account/
## Get your private key from cmd line
```
$ gpg --export-secret-key -a "username"
```