Writing a blob object to the database

In this example, we'll see how we can use plumbing commands to add blob objects to the database. This is, of course, used internally by the git add command; however, this can also be useful if you, for example, need to add the public part of your GPG key to the Git repository so that signed tags can be verified. You can then, after you've added the key, tag the blob ID so that the other committers can find it.

Getting ready

We'll create and use a new repository for this example and the next couple of examples. Let's create a new repository in the myplumbing folder:

$ git init myplumbing
Initialized empty Git repository in /path/to/myplumbing/.git/
$ cd myplumbing
$ git status
On branch master

Initial commit ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.