2. How to... : Import an Existing Git Repo
   
Import an Existing Git Repo
If you have an existing Git repository that you would like to register with GitCentric and import into AccuRev, you can import a snapshot of the current state of the repository into AccuRev.
A Note About AccuRev Depots
You must import a Git repository into a case-sensitive AccuRev depot, unless you are 100% certain that repo is case-insensitive.
Your Git repo will be case-sensitive if it has been created and developed exclusively in a Linux/UNIX environment. If it has included any development from Windows or OS X developers, there is a good chance (but not 100% certainty) that the repo is case-insensitive, even if the repo itself is hosted on a Linux/UNIX server. If you attempt to map a case-sensitive repo to a case-insensitive depot, you will encounter errors, either at import time, or further down the road.
By default, AccuRev depots are case-insensitive, and the depot that is created during a new AccuRev installation is always case-insensitive. If you need a case-sensitive AccuRev depot for use with GitCentric, you (or an AccuRev administrator) must create one using AccuRev depot GUI features shown in the following illustration. See the AccuRev documentation for more information, or for the equivalent CLI commands to perform the same operation.
Import a Snapshot of the Latest Heads into AccuRev
If you do not care about capturing the repo history, the process can be as simple as making a copy of the repository under the GitCentric repo storage directory. The next time you restart the GitCentric server the repo will be visible through the GitCentric UI.
To import a repository and just capture its current state:
1. Create a copy of the repo in your GitCentric repository home.
cd <gc_repo_home> (For example, /home/<gc_installer>/AccuRevGitCentric/site/git)
cp -r <orig_repo>/<new_repo_name>
2. Restart the GitCentric server. You have two options to accomplish this:
Stopping and restarting the Tomcat web server:
cd <ac_home>/WebUI/tomcat/bin
./shutdown.sh
./startup.sh
Note: Make sure that the user starting Tomcat has write access to the logs, temp, webapps, and work directories in <ac_home>/WebUI/tomcat. This user should have read access to all other Tomcat directories and files.
Flushing the cache with an SSH command (entered on a single line):
ssh -p 29418 <username>@<gc_server> gerrit flush-caches --cache projects
--cache project_list
3. Configure the repository through GitCentric and allow users to clone it as necessary as described in the other sections of this chapter.