Reputation: 1472
Is it possible to git clone
existing git p4
repository so it will be possible to use git p4
for the new repository?
Here is the usecase: I have desktop PC with full repository cloned from perforce (git p4 clone <somepath>@all
) an want to clone it to laptop without touching p4 server (link to it is wery slow and laggy) an be able to commit changes to perforce. Ideally it would be great to use git clone --depth
and sparse clone to reduce laptop disk usage.
Upvotes: 5
Views: 377
Reputation: 1976
In the original git repository you should have a directory structure under .git/refs
that is similar to the following:
.git/refs/
.git/refs/heads
.git/refs/tags
.git/refs/remotes
.git/refs/remotes/p4
To fetch the p4 information the following line must be added to the [remote "origin"]
entry in the cloned repository:
fetch = +refs/remotes/p4/*:refs/remotes/p4/*
This can also be achieved by running the following command inside the cloned repository:
git config --add remote.origin.fetch '+refs/remotes/p4/*:refs/remotes/p4/*'
Note: the fetch
entries matches the directory structure above, so you need to confirm if yours is the same. Look here for more information on refspecs.
At this point it's just a matter of running git fetch
and from this moment onward all git p4
commands should work as usual.
Upvotes: 3
Reputation: 411182
No. git p4
works by syncing up with a Perforce checkout (it's a wrapper around some p4 commands), so you also need to have the Perforce checkout accessible.
You could clone the Git repo to your laptop, do your work, push your changes to that Git repo, and run git p4
from there when you're ready to submit your changes.
Upvotes: 3