git-p4 sync fails "No remote p4 branches. Perhaps you never did "git p4 clone" in here."

58 Views Asked by At

I have two git repositories one is original one and the other is forked one from original one. Forked one is for testing purpose. I am running git-p4 commands on on forked one. I get the issue as follows:-

Syncing with origin first, using "git fetch origin" Creating/updating branch(es) in refs/remotes/p4/ based on origin branch(es) No remote p4 branches. Perhaps you never did "git p4 clone" in here.

git-p4 command:- python3 /usr/local/bin/git-p4 sync --use-client-spec --keep-path --branch refs/heads/test/main

there is no issue in original repository. When i had a deep dive into check the difference among both repos by checking 'git branch -a' I notice the following differences :-

  1. remotes/p4/HEAD -> gp4/main entry is only present in original repo and not for forked repo.
  2. inside .git folder of original repo i could see this 'p4' folder ".git/refs/remotes/p4" and the same is not present in forked repo.

How can i resolve this issue?

I try to manually do the following steps :-

Open a terminal or command prompt.

Navigate to the original repository's .git/refs/remotes/p4 folder.

Copy the branch references from the original repository to a temporary location (e.g., a new folder on your desktop).

Navigate to the forked repository's .git/refs/remotes folder.

Create a new folder named p4 under .git/refs/remotes.

Copy the branch references from the temporary location to the newly created .git/refs/remotes/p4 folder in the forked repository.

Note: Make sure to preserve the same folder structure and filenames.

After copying the branch references, navigate into the forked repository and run your git-p4 sync command: Where i hit into same issue.

Please advice.

0

There are 0 best solutions below