Search code examples
gitversion-controlrepo

Why is REPO concatenating remote address and folder?


I'm trying to use repo to fetch several git repositories for a project. I have a personal git server where all the git repositories are hosted

I'm able to manually clone individual repos executing this command:

git clone my_repo@my_repo_address:repo_a

But since I need the same repositories for different projects I decided to use REPO instead of cloning manually.

I have created a default.xml file to work with and it contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote  name="project"
           fetch="my_repo@my_repo_address"/>

  <project name="repo_a" remote="project" revision="master" path="a"/>
  <project name="repo_b" remote="project" revision="master" path="b"/>
  <project name="repo_c" remote="project" revision="master" path="c"/>
</manifest>

I have this default.xml file hosted on the same git server on a repository called git-repo-fetch. I can successfully init the repo as follows:

 repo init -u my_repo@my_repo_address:git-repo-fetch

And it inits successfully. But when I execute repo sync I get the error:

Fetching project repo_c
fatal: 'git-repo-fetch/my_repo@my_repo_address/repo_c' does not appear to be a git repository
fatal: Could not read from remote repository.

And my question is why is repo concatenating the XML repo name (git-repo-fetch) with the fetch address (my_repo@my_repo_address)?

By doing so, it tries to fetch from git-repo-fetch/my_repo@my_repo_address which is wrong.


Solution

  • As far as I can see (like in this thread from 2011), repo has always supported the ssh:// URL scheme

    ssh://[user@]host.xz[:port]/path/to/repo.git/ 
    

    And not the scp-like syntax user@host:repo.

    user@host:path is a nice shorthand on the command line, but ssh:// is less ambiguous for a manifest XML file.

    With the scp-syntax, repo does "munge" the URL, as mentioned in 2012.