Answer a question

We are using gpg signing of commits in repository but when I try to commit changes in vscode I got this error:

gpg: cannot open tty `/dev/tty': No such device or address
error: gpg failed to sign the data

If I do "git commit" in vscode's terminal all is ok. So the problem not in git/gpg/gpg-agent I guess. Is there a way to make vscode deal with this?

Answers

A pull request was recently merged and will be available in the next release of VS Code (August 2017 / 1.16). Alternatively, it is already available in insiders builds.

When available it can be enabled by adding the following to user or workspace settings (file > preferences > settings)

git.enableCommitSigning: true

Prerequisite: Having git setup to sign commits. Instructions can be found here - https://help.github.com/articles/signing-commits-using-gpg/

To set all commits for a repository to be signed by default, in Git versions 2.0.0 and above, run git config commit.gpgsign true. To set all commits in any local repository on your computer to be signed by default, run git config --global commit.gpgsign true.

To store your GPG key passphrase so you don't have to enter it every time you sign a commit, we recommend using the following tools:

For Mac users, the GPG Suite allows you to store your GPG key passphrase in the Mac OS Keychain. For Windows users, the Gpg4win integrates with other Windows tools. You can also manually configure gpg-agent to save your GPG key passphrase, but this doesn't integrate with Mac OS Keychain like ssh-agent and requires more setup.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐