Pushing a commit to the master branch directly

With the code modification done, lets try to add the source code to our Git repository. To do so, we will go through the following steps:

  1. Navigate to the location of the clone of your repository
  2. Commit the new file and directory:
git add -A 
git commit -m "Testing master branch protection."
  1. Push the commits to the master branch:
git push

The push command should fail with an error message, such as the following:

$ git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 367 bytes | 367.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Waiting on code owner review from ldesrosi.
To https://github.com/HyperledgerHandsOn/trade-finance-logistics.git
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://Github.com/yourID/trading-smart-contract.Git'

If you get a similar message, you know you're on the right path. If the push command succeeds, you should probably go back to the Protecting the master branch section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset