{"id":22423458,"url":"https://github.com/prantlf/docker-git-p4","last_synced_at":"2026-05-11T06:21:26.014Z","repository":{"id":150431650,"uuid":"279019677","full_name":"prantlf/docker-git-p4","owner":"prantlf","description":"Docker image: Git, Perforce and git-p4 clients for synchronizing source repositories on Alpine Linux","archived":false,"fork":false,"pushed_at":"2022-10-24T06:48:40.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T10:43:09.231Z","etag":null,"topics":["docker","docker-image","git","git-p4","p4","perforce"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prantlf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-12T08:04:41.000Z","updated_at":"2023-03-19T18:45:31.000Z","dependencies_parsed_at":"2023-04-24T17:27:22.238Z","dependency_job_id":null,"html_url":"https://github.com/prantlf/docker-git-p4","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fdocker-git-p4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fdocker-git-p4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fdocker-git-p4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fdocker-git-p4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/docker-git-p4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791899,"owners_count":20672668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-image","git","git-p4","p4","perforce"],"created_at":"2024-12-05T18:11:26.003Z","updated_at":"2026-05-11T06:21:22.779Z","avatar_url":"https://github.com/prantlf.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prantlf/git-p4\n\n[Docker] image: [Git], [Perforce] and [git-p4] clients for synchronizing source repositories on Alpine Linux\n\n[This image] is supposed to manage sources in [Perforce] using [Git] interface with the help of [git-p4]. Tools `git` and `p4` are available to be used separately, of course. This image is built automatically on the top of the tag `latest` from the [Alpine repository], so that it is always based on the latest [Alpine Linux]. [Git] has to be updated from time to time by triggering a new build manually. [Perforce] and [git-p4] have to updated in the `Dockerfile`.\n\nIf you have trouble pulling the image from the Docker's default hub.docker.com, try gitlab.com, where [this project] is primarily maintained: `registry.gitlab.com/prantlf/docker-git-p4`.\n\n`git-p4` is a convenient way how to sync sources from Perforce without creating a Perforce client and dealing with read-only files created by `p4`:\n\n* Clone the project sources `git p4 clone //projects/first`.\n* Update the sources by `git p4 sync \u0026\u0026 git p4 rebase`.\n* Use local `git` commands to modify the branch `master`.\n* Push changes to the repository by `git p4 submit`.\n\n## Tags\n\n- [`latest`], `2.38.1-22.1`, `2.34.1-21.2`\n\n## Install\n\n```\ndocker pull prantlf/git-p4\n```\n\n## Use\n\nYou can run `git`, `p4` and `git-p4` commands with `docker` mapping the current directory as the working directory:\n\n    GITP4=\"docker run --rm -it -v \"\"${PWD}\"\":/app -w /app prantlf/git-p4\"\n    $GITP4 git\n    $GITP4 p4\n    $GITP4 git p4\n\nPerforce client needs a server connection and credentials to a Perforce server. They are usually available in the environment, from where you can pass them to the docker container:\n\n    docker run --rm -it -v \"${PWD}\":/app -w /app \\\n      -e P4PORT -e P4USER -e P4PASSWD prantlf/git-p4 \\\n      git p4 clone //projects/first\n\nYou can pass the environment variable values on the command line too:\n\n    docker run --rm -it -v \"${PWD}\":/app -w /app \\\n      -e P4PORT=myperforce:1666 -e P4USER=myself prantlf/git-p4 \\\n      p4 login \u0026\u0026 git p4 sync\n\nOr you can supply them from a file:\n\n    docker run --rm -it -v \"${PWD}\":/app -w /app \\\n      --env-file ~/p4env prantlf/git-p4 \\\n      git p4 submit\n\nIf you omit the environment variable with the Perforce password, you will need either to log in on the command  line, or to provide the Perforce `.p4tickets` file in a user home directory mapped via the volume `/root`, or to retain the container where you logged in once and continue use it instead of having it constantly re-created.\n\n    # Authenticate and create .p4enviro and .p4tickets in the curent directory.\n    docker run --rm -it -v \"${PWD}\":/app -w /app -v \"${PWD}\":/root \\\n      -e P4PORT=myperforce:1666 -e P4USER=myself prantlf/git-p4 \\\n      p4 login\n    # Use the suthentication file in the current directory to clone a repository\n    # to a subdirectory in the current directory.\n    docker run --rm -it -v \"${PWD}\":/app -w /app -v \"${PWD}\":/root \\\n      -e P4PORT=myperforce:1666 -e P4USER=myself prantlf/git-p4 \\\n      git p4 clone //projects/first\n\n    # Create an authenticated container.\n    docker run --name myp4 -it -v \"${PWD}\":/app -w /app \\\n      -e P4PORT=myperforce:1666 -e P4USER=myself prantlf/git-p4 \\\n      p4 login\n    # Start the authenticated container, sync sources and stop the container.\n    docker start myp4\n    docker exec myp4 git p4 sync\n    docker stop myp4\n\n### Gotchas\n\nIf you want to submit changes to Perforce, you will need to create a (separate) Perforce client for the depot that you cloned by `git-p4`. It will be used by `git p4 submit`, which you will supply it by an environment variable: `P4CLIENT=myclient`, for example.\n\nThe git repository created by `git p4 clone` is not to share with the others freely, so that they would maintain their `master` branches, marge occasionally from you and you merge from them. When you pull from Perforce, you will rebase your local commits on it. If you shared them with somebody, their hashes will differ after the rebase and you will nto be able to merge them using the common parent. Every developer should maintain their own `git-p4` clone, or you can use `git format-patch` and `git apply` to share local changes outside Perforce.\n\nThe repository maintained by `git-p4` will get slow after some time. I suspect that as the history grows, the costs of applying `p4` and `git` commands on the source tree grow as well. Maybe it is not as efficient as a pure Git repository management. The workaround is to delete the repository clone and clone the Perforce depot by `git p4` again. It will start with a clean history in the full speed again.\n\n## Build, Test and Publish\n\nThe local image is built as `git-p4` and pushed to the docker hub as `prantlf/git-p4:latest`.\n\nRemove an old local image:\n\n    make clean\n\nCheck the `Dockerfile`:\n\n    make lint\n\nBuild a new local image:\n\n    make build\n\nEnter an interactive shell inside the created image:\n\n    make run\n\nLogin to the docker hub:\n\n    make login\n\nPush the local image to the docker hub:\n\n    make push\n\n## License\n\nCopyright (c) 2020-2022 Ferdinand Prantl\n\nLicensed under the MIT license.\n\n[Docker]: https://www.docker.com/\n[This image]: https://hub.docker.com/repository/docker/prantlf/git-p4\n[this project]: https://gitlab.com/prantlf/docker-git-p4#prantlfgit-p4\n[`latest`]: https://hub.docker.com/repository/docker/prantlf/git-p4/tags\n[Perforce]: https://www.perforce.com/products/helix-core\n[Git]: https://git-scm.com/\n[git-p4]: https://git-scm.com/docs/git-p4\n[Alpine repository]: https://hub.docker.com/_/alpine\n[Alpine Linux]: https://alpinelinux.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fdocker-git-p4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Fdocker-git-p4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fdocker-git-p4/lists"}