What is the use of the below two commands :
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
repo init -u https://android.googlesource.com/platform/manifest
I have already done this in the WORKING_DIRECTORY for one Download.Now I want to use the same repo and same manifest but in some other folder (out side WORKING_DIRECTORY).
Where can I see the Android Manifest file and what does it signifies ?
Is it mandatory to run the above two commands in the new directory , where my repo is already exported in the PATH.
thnx and Rgds,
Rp
repo is a tool to use multiple git repositories as one big meta repository.
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Downloads (installs) the repo tool into your bin directory (used roughly like Program Files in Windows). That step is required only once. Afterwards you should be able to use repo from the command line in every directory.
$ repo init -u https://android.googlesource.com/platform/manifest
Initiates such a meta repository based on the manifest xml file (content of default.xml). That file contains a list of git repositories and paths for them. repo init does more or less git clone for each specified git.
$ repo sync
goes through all git repositories and downloads & updates their content in the directories that were created by the previous command. You could do git pull --rebase for each git yourself but that would take quite the time since Android consists of 40 or so git repositories.
The first command (curl), if performed without modification, needs only be run once on your system (unless the repo tool is updated, in which case you must run it again to get the latest). This is because its output, the repo command, is not in your current directory, it's relative to youor home directory instead.
The "repo" command must be run again when you wish to download the repo to a new working tree.
Related
I'm working on a project recently, the project using 'repo' to manage the code. In the 'Tina_v3' folder, there are many subdirectory using git to manage the source code; such as folder: target, package,etc. I'm not familiar about 'repo';
my question is : how to record the whole project by using 'repo' command, Does 'repo' have a command like "git commit", I don't like to using 'repo upload';
We initiated a repo locally using an existing manifest.
repo init -u ssh://ger-repository/my_project-manifests -m my_manifest.xml --mirror
Now, the manifest file changed. Running the init command is not possible:
fatal: --mirror not supported on existing client
How can we update the manifest without deleting all mirror folder and re-syncing again?
This might not be possible, considering this patch which proposed to replace that error message with:
fatal: --mirror is only supported when initializing a new workspace.
Either delete the .repo folder in this workspace, or initialize in another location.
If this is about the same repos, but with a different URL, then this thread mentioned:
If you've been able to clone all the gits you're almost there, just use
the insteadOf trick on the clients if the relative URLs aren't available
in the manifest you're mirroring.
[url "https://yourserver.example.com/"]
insteadOf = https://android.googlesource.com/
I have used this command to archive a git source code:
git archive --format=tgz -o ~/myproj-20180402.tgz --prefix=myproj/ master
Are there same/similar way to archive a AOSP repo branch or tag. How to do ? Any help would be greatly appreciated.
AOSP code is not a single git project, it's actually many more (hundreds). So there is not a git command per-se.
What you could do is use repo this way:
repo forall -j16 "<your-git-command-1; your-git-command-2>"
So for the exact git command you proposed it would be:
repo forall -j16 "git archive --format=tgz -o ~/myproj-20180402.tgz --prefix=myproj/ master"
But keep in mind there is not a single git project, so you will end up with hundreds of archives, each inside it's root dir. Check the manifest you sync for a full list of projects and it's location locally.
From the title of my question you can see what my problem is. I have an app on GitHub but I don't have .gitnore file. Now I want to make that file. I read somewhere that I must delete some files with terminal(Ubuntu) and then to make new .gitnore file.
Could someone tell me how to do all that stuff?
EDIT: I followed a solution from another question but when I write it into the terminal I received this:
dev3#dev3-All-Series:~$ git rm --cached
fatal: Not a git repository (or any of the parent directories): .git
dev3#dev3-All-Series:~$
You can remove the files on your local machine, and push to the repository. If the files are removed there, thén you can make the .gitnore file. That way, you don't end up with useless 'dead' folders or files on your repo. This way you don't need local access to the files, just your git client.
If you add the .gitnore first, you won't be able to delete the files because they will be ignored :).
If you already have a .gitnore file setup, you can do the following to remove files:
You can remove them from the repository manually:
git rm --cached file1 file2 dir/file3
Or, if you have a lot of files:
git rm --cached `git ls-files -i --exclude-from=.gitignore`
But this doesn't seem to work in Git Bash on Windows. It produces an error message. The following works better:
git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
(found that solution here)
The Android source is a large hierarchy of git repositories. They are managed by a custom script called repo. Repo determines which git repositories to manage using a manifest.xml. The manifest.xml of Android is hosted in a git repository along with all the other git repositories.
How is this repository managed in Android? Specifically how are the different branches and the different files hosted in each branch organised?
First, repo init creates the .repo directory, clones the git repository https://android.googlesource.com/tools/repo to .repo/repo, and the git repository specified with the -u option to a bare repository at .repo/manifests.git. After that, it creates the .repo/manifests directory, converts it into a git repository through creating symbolic links from .repo/manifests/.git to .repo/manifests.git. It then checks out the branch specified in -b, and creates a symbolic link .repo/manifest.xml pointing to the specified file (-m option) in .repo/manifests, by default .repo/manifests/default.xml.
Roughly as follows:
repo init -u $URL -b $BRANCH -m $MANIFEST
--------------------
mkdir .repo; cd .repo
git clone https://android.googlesource.com/tools/repo
git clone --bare $URL manifests.git
mkdir -p manifests/.git; cd manifests/.git
for i in ../../manifests.git/*; do ln -s $ı .; done
cd ..
git checkout $BRANCH -- .
cd ..
ln -s manifests/$MANIFEST manifest.xml
You can trace what really happens with repo --trace init ...
Then, repo sync clones git repositories to .repo/projects for each project in manifest.xml and local_manifest.xml, creates working directories with .git having symlinks to the corresponding bare repository, checks out the branch specified in the manifest, and updates .repo/project.list. The case where the projects are already there is slightly different, essentially performing a git pull --rebase.
At the root of the repo is a hidden directory named ".repo". Inside you will find a git project named "manifests" which usually contains a file named "default.xml". This file contains information about all the projects and where their associated git repositories are located. This file is also versioned thus when you use the "repo init -b XYZ" command it will be reverted and you can back to older branches that may have added/removed git projects compared to the head.
Here is a link to the git repo document describing the manifest format:
https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md