bhoward
bhoward

Reputation: 2890

Android repo init - how to run non-interactively (or without name/email prompting)

I'm building a script that will download several versions of Android. Rather than pulling each repository from scratch, I'd like to keep a base repository that I can re-init to the right version before syncing (and then copying the result to a safe directory).

However, repo init always prompts for a name and email address, foiling my scripting attempts. I've looked through the repo source and tried options like -q, but it seems like the prompting is coming from the underlying git commands.

Any suggestions on doing a repo init -b without interaction?

Upvotes: 8

Views: 9430

Answers (3)

Wren T.
Wren T.

Reputation: 606

Tested solution: If you set user.name and user.email in the global git config, repo will not prompt for your name/email. You can set them by running the following git commands:

$ git config --global user.name 'Warren Turkal'
$ git config --global user.email '[email protected]'

Untested possible solution: I think you can also set those attributes in the manifest repo instead of changing your global config if you only want the name and email to be set for the one repo repository. To do that, you can do something like the following from the repo root:

$ cd .repo/manifests
$ git config user.name 'Warren Turkal'
$ git config user.email '[email protected]'

Upvotes: 11

Atemu
Atemu

Reputation: 406

One way to force git-repo to be non-interactive is to attach something to its stdin:

repo init < /dev/null

Upvotes: 0

Adam Dymitruk
Adam Dymitruk

Reputation: 129724

Why not just use git on it's own? That is way more scriptable. Pipe git archive to tar to export or git --work-tree=where/you/want/the/files checkout tag_name .

Upvotes: 0

Related Questions