CLI Example

This example walks you through the entire process of creating a repository, cloning it, populating it with content, pushing, and finally mapping one of its branches to an AccuRev stream, all through Git, Gerrit, and GitCentric CLI commands.
  1. Create a repository with an initial empty commit:
    ssh -p 29418 yourUsername@yourServer gerrit create-project --empty-commit repoName
  2. Register the repo with GitCentric and associate it with an AccuRev Server:
    ssh -p 29418 yourUsername@yourServer gitcentric config-repo repoName
    -S 10.0.0.182:5050 -u syncUser -p syncUserPassword
  3. Clone the repo.
    git clone ssh://yourUsername@yourServer:29418/repoName repoName
  4. Change to the new clone’s directory and configure it:
    cd repo_tues2
    git config user.name "Firstname Lastname"
    git config user.email "f.lastname@yourdomain.com"
    git config remote.origin.push refs/heads/*:refs/for/*
  5. Using your preferred text editor, create a file in the clone.
  6. Add, commit, and push the file:
    git add --all
    git commit --all -m"First commit"
    git push
    Note: This step creates branch master, which must exist before the next step.
  7. Map the master branch to a stream named agc_devel on the AccuRev Server:
    ssh -p 29418 yourUsername@yourServer gitcentric config-branch repoName
    -b master -s streamName -e /
  8. Display a listing showing the mapped repo:
    ssh -p 29418 yourUsername@yourServer gitcentric ls-repo