Skip to content

Commit e8e5ffe

Browse files
authored
Update README.md
1 parent 8d150d1 commit e8e5ffe

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,28 @@ Notes:
4141

4242
- You can turn on more verbose debugging information by setting the environmental variable `GIT_CREDENTIAL_FORWARDER_DEBUG` to `true`
4343

44+
### Using a Dockerfile
45+
46+
Here's a strategy to make this fairly easy to use with a Docker container built with a Dockerfile.
47+
48+
On the host, set a specific port that you will listen on by configuring the env variable `GIT_CREDENTIAL_FORWARDER_PORT`.
49+
50+
Add these lines in the Dockerfile
51+
52+
```
53+
RUN curl -LO https://github.com/sam-mfb/git-credential-forwarder/releases/download/v[VERSION]/git-credential-forwarder.zip
54+
RUN unzip git-credential-forwarder.zip
55+
RUN git config --global credential.helper '!f(){ node ~/gcf-client.js $*; }; f'
56+
ENV GIT_CREDENTIAL_FORWARDER_SERVER host.docker.internal:[PORT]
57+
```
58+
Of course, replace `[VERSION]` and `[PORT]` with the actual version number and port number (or use Docker's `ARG` command).
59+
60+
Note that you may need to add some other things to your git configuration. For example, to work with Azure DevOps OAuth2 authentication add:
61+
62+
```
63+
RUN git config --global credential.https://dev.azure.com.useHttpPath true
64+
```
65+
4466
## Using a File Socket
4567

4668
By default the server uses a tcp server listening on `localhost`. You can tell it to use a file socket instead of tcp by setting the environmental variable `GIT_CREDENTIAL_FORWARDER_SOCKET` to the location you want the socket created. You must have permission to create a socket at that location.

0 commit comments

Comments
 (0)