TLDR
How does one run a git p4 submit
on a bare repo? Which command line option to git p4 submit
is that?
LONG STORY
I would like my team within my company, which uses perforce, to move to git. I want to use Git-P4 to achieve that. I want to have a section of perforce cloned to a git repo, and make that a remote repo, so that people would clone that, push changes to the remote repo and I would periodically resubmit the changes made in the remote repo back to the perforce. So I followed this tutorial
http://answers.perforce.com/articles/KB_Article/Git-P4
which boiled down to this command:
git p4 clone //depot/path.to/folder@all folder --bare
That works, then on my client machine I do
git clone "user1@server:/home/user1/path/to/folder"
and that's fine and it shows up so I make an edit to a test file, then do the
git add file
git commit -m 'test'
git push.
and that works, but then back on the remote repo now in the folder with the repo, I do,
git p4 rebase
and I get this
git p4 rebase
Performing incremental import into refs/remotes/p4/master git branch
Depot paths: //depot/path.to/folder/
No changes to import!
fatal: This operation must be run in a work tree
Some files in your working directory are modified and different than what is in your index. You can use git update-index <filename> to bring the index up-to-date or stash away all your changes with git stash.
and
git p4 submit
gives me this:
Perforce checkout for depot path //depot/path.to/folder/ located at /home/user1/path/to/perforce.folder/
Synchronizing p4 checkout...
... - file(s) up-to-date.
fatal: Not a git repository: '.'
Command failed: ['git', 'rev-list', '--no-merges', 'remotes/p4/master..master']
So the problem is that the the git repo can't be a bare repo when I do a submit, it has to be a regular one with a working directory, right? But if that's the case, why even give me a --bare
option? The reason I'm doing the --bare
option is that when I left it out I got a different set of errors about uncommitted changes in the working copy of the remote repo. But how do I make the git p4 submit without any errors?