How to do it...

We want to be able to push to a remote branch but, unfortunately, Git will try to authenticate through HTTPS for the jgit repository before the hooks are executed. Because of this, we will create a local clone from the chapter7.1 directory, as follows. This will make our remote a local folder:

$ git clone --branch master ./chapter7.1/ chapter7.2
Cloning into ' chapter7.2'...
done.
Checking out files: 100% (1576/1576), done.
$ cd chapter7.2$ git branch* master

We are cloning the chapter7.1 directory in a folder named chapter7.2, and will check the master branch when the clone has finished.

What we now want to do is to create a commit with a commit message that has nopush as part of it. By adding this word to the commit message, ...

Get Git Version Control Cookbook 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.