Basic Syntax
The GitCentric CLI commands are executed as SSH remote commands, which require that you have an SSH client installed. The syntax for a GitCentric CLI command executed from SSH is:
ssh -p <port> <user>@<host> gitcentric [<command>] [[<arg>]...]] [--help] [--]
<port> | GitCentric port number, typically 29418. |
<user>@<host> | The SSH user account used with
GitCentric (for example
myusername@localhost ).
|
<command> | May be one of the following:
|
<arg> | One or more arguments to pass to
<command> . These vary based on command.
|
--help, -h | Displays the on-line help for the current command. Specifying
--help with no other arguments (for example,
gitcentric --help ) returns a list of all available sub-commands.
|
-- |
Specifies that the rest of the command line is to be considered arguments, not options. For example, if you need to pass a repo name that starts with
- you would precede it with
For example: ...config-repo Repo1 Repo2 -- -Repo3 Repo4 -Repo5 |
Spaces and Quoting
To include a space in arguments for a GitCentric SSH command, you must use quotes.
In addition, Microsoft Windows requires that you nest single quotes within double-quotes. In the example below, double-quotes are provided for the Microsoft Windows shell, and single-quotes are nested within the double-quotes for the SSH command-line parser.
C:\source\TestProject>ssh -p 29418 mylogin@localhost gitcentric config-branch --branch refs/heads/master -p 1 -e 3 -s 2 -d "'xxxx yyyy'" --initialSync git TestProject
CLI example
- Create a repository with an initial empty commit:
ssh -p 29418 yourUsername@yourServer gerrit create-project --empty-commit repoName
- 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
- Clone the repo.
git clone ssh://yourUsername@yourServer:29418/repoName repoName
- 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/*
- Using your preferred text editor, create a file in the clone.
- 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.
- 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 /
- Display a listing showing the mapped repo:
ssh -p 29418 yourUsername@yourServer gitcentric ls-repo