Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

git - Repo with non android projects

I am working on a project where I am trying to unite several modules into one solution. The modules are each in their own folder and are git repositories. These are all stored in C:sourcecodeModules Eventually they will be on GitHub. After deep reviews of different methods of using a Solutions made up of Module stored in git repositories, I decided to try Google's Repo that was built for AOSP.

I installed all the tools based on the Repo requirements here https://source.android.com/setup/develop and created a folder C:sourcecodeRepotest in that folder I created a file called default.xml. The contents of that folder are very simple:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

  <remote  name="origin"
           fetch="/c/sourcecode/Modules" />
  <default revision="master"/>

  <project path="AnalystQualification" name="AnalystQualification" />
</manifest>

I launch git-bash as administrator and run:

$ cd /c/sourcecode/Repotest/
$ repo init -u default.xml

I get the output:

$ repo init -u default.xml
Downloading manifest from default.xml
Traceback (most recent call last):
  File "C:sourcecodeRepotest.repo
epomain.py", line 630, in <module>
    _Main(sys.argv[1:])
  File "C:sourcecodeRepotest.repo
epomain.py", line 604, in _Main
    result = run()
  File "C:sourcecodeRepotest.repo
epomain.py", line 597, in <lambda>
    run = lambda: repo._Run(name, gopts, argv) or 0
  File "C:sourcecodeRepotest.repo
epomain.py", line 266, in _Run
    result = cmd.Execute(copts, cargs)
  File "C:sourcecodeRepotest.repo
eposubcmdsinit.py", line 531, in Execute
    self._SyncManifest(opt)
  File "C:sourcecodeRepotest.repo
eposubcmdsinit.py", line 232, in _SyncManifest
    default_branch = m.ResolveRemoteHead()
  File "C:sourcecodeRepotest.repo
epoproject.py", line 1926, in ResolveRemoteHead
    output = self.bare_git.ls_remote('-q', '--symref', '--exit-code', name, 'HEAD')
  File "C:sourcecodeRepotest.repo
epoproject.py", line 3040, in runner
    raise GitError('%s %s: %s' %
error.GitError: manifests ls-remote: fatal: invalid gitfile format: default.xml
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Downloading Repo source from https://gerrit.googlesource.com/git-repo

I think this error is telling me that setup in default.xml cant see the .git folder in the modules/analystqualification directory but I can see it if I ls -l

$ ls -l /C/sourcecode/Modules/AnalystQualification
total 4
drwxr-xr-x 1 adam.wheeler 1049089 0 Jan 12 10:01 Setup_AQ/

Any help is appreciated here. Thanks!

Adam


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
repo init -u url_to_manifest_repo -m foo.xml -b manifest_repo_branch

url_to_manifest_repo should be a git repository that tracks foo.xml. It can be either in the local disk or in a remote hosting server. In your case, it's /c/sourcecode/Repotest. Make sure that /c/sourcecode/Repotest is a git repository and default.xml has been trakced.

foo.xml is the manifest file's path relative to url_to_manifest_repo root. -m foo.xml can be omitted. If so, -m default.xml is used by default.

manifest_repo_branch is the branch that holds the specific version of foo.xml. If -b manifest_repo_branch is omitted, it defaults to -b master.

So in your case the command would be:

repo init -u /c/sourcecode/Repotest -m default.xml -b master

or simply:

repo init -u /c/sourcecode/Repotest

For a local repository, it could also be -u file:///c/sourcecode/Repotest.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...