Skip to main content

Approving a push

All pushes that flow through GitProxy require an approval (authorisation). Until a push is approved, GitProxy will block the commits from being sent to the upstream repository. To approve a push, you can use the REST API or web UI.

Using the REST API

Prerequisites

Instructions

1. Find the tracking ID

Following on from Push via GitProxy, a unique & shareable link is generated:

http://localhost:8080/dashboard/push/0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f

The ID for your push corresponds to the last part of the URL:

0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f

2. Authenticate with the API

Use the default & auto-generated GitProxy username & password credentials to obtain a cookie. The cookie value is saved to a file (git-proxy-cookie):

curl -H "Content-Type: application/json" -c git-proxy-cookie -X POST \
-d '{"username":"admin","password":"admin"}' http://localhost:8080/auth/login

3. Retrieve push with ID from database

Using the cookie generated, execute a GET request to confirm that your push with ID exists in the database:

curl -I -b ./git-proxy-cookie http://localhost:8080/api/v1/push/${ID}

You should receive a 200 OK in the response. If ID does not exist then you'll receive a 404 error.

4. Approve the push with ID

Using the same cookie again, send a POST command to approve the push:

curl -b ./git-proxy-cookie \
-X POST http://localhost:8080/api/v1/push/${ID}/authorise

5. Re-push your code

Execute git push to send your approved code to the upstream repository:

$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 470 bytes | 470.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.

Using the CLI

Prerequisites

  • Proxy and REST API are running (default behaviour)
  • The GitProxy URL is configured via the GIT_PROXY_UI_HOST (defaults to http://localhost) and GIT_PROXY_UI_PORT (defaults to 8080) environment variables. Note: this documentation assumes that GitProxy UI is running on http://git-proxy.com:8080.
  • Intercepting a push instructions have been followed and you've reached Push via GitProxy

Instructions

1. Find the tracking ID

Following on from Push via GitProxy, you'll receive a unique URL:

http://localhost:8080/requests/0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f

The ID for your push corresponds to the last part of the URL:

0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f

2. Authenticate with the CLI

Use the default & auto-generated GitProxy username & password credentials to authenticate and obtain a cookie. The cookie value is saved to a file (git-proxy-cookie):

$ npx -- @finos/git-proxy-cli login --username admin --password admin
Login "admin" <admin@place.com> (admin): OK

The CLI create-user command provisions users in GitProxy's local database only. It does not create users in external identity providers.

3. Approve the push with ID

Use the commit ID to approve your push with the CLI:

$ npx -- @finos/git-proxy-cli authorise --id 0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f
Authorise: ID: '0000000000000000000000000000000000000000__79b4d8953cbc324bcc1eb53d6412ff89666c241f': OK

4. Re-push your code

Execute git push to send your approved code through GitProxy to the upstream repository:

$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 470 bytes | 470.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.

5. Log out

Clean up your connect cookie via logging out:

$ npx -- @finos/git-proxy-cli logout
Logout: OK

Using the UI

Prerequisites

  • Proxy and REST API are running (default behaviour)
  • Proxy and REST API are running on localhost:8000 and localhost:8080, respectively
  • UI is running on localhost:8080

Instructions

1. Login as administrator

Login to the dashboard. As the UI is running on port 3000, the URL is:

http://localhost:8080/login

Fill in the form using the following credentials:

Username: admin
Password: admin

Once submitted, you should be logged in as administrator 💪

Following on from Push via GitProxy, a unique & shareable link is generated:

remote: GitProxy has received your push ✅
remote:
remote: 🔗 Shareable Link
remote: http://localhost:8080/dashboard/push/000000__b12557

Insert the URL directly into your web browser.

3. Approve the push using the dashboard

Press the approve button and a modal will appear. Happy with the contents of the push? 🤗

In the modal, check the tickbox ✅ and press the approve button.

4. Re-push your code

Execute git push to send your approved code to the upstream repository:

$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 470 bytes | 470.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.