User:Srilakshmi sonim/sandbox

To Create a New empty git repo on a branch

edit

Example : To Create a empty git repo NetworkSelection in simt mirror under the path platform/vendor/sonim/ on the branch 8926-X700-10152-BELL-MR1-MSI1

edit
  1. Login to 10.15.1.31 server with "repouser" credentials. ( userid: repouser , passwd: repouser123)
  2. Create the directory ( .git) in the requested path inside the server mirror.
  3. To create a directory, enter the following commands at the command prompt.
    cd /home/repouser/gitrepos/[simt-mirror] or [borqs-mirror]based on the request to the requested path/  
    Example: cd /home/repouser/gitrepos/simt_mirror/platform/vendor
    mkdir <empty-repo-name-requested.git>
    Example: mkdir NetworkSelection.git
  4. Initialize the bare git repo.
  5. git init --bare ./<empty-repo-name-requested.git>/  
    Example: git init --bare ./NetworkSelection.git/
  6. Create a gerrit link via the gerrit account (service account). Login to 10.15.1.31 server with "gerrit" credentials.
  7.  cd  /home/gerrit/gerrit-home/git  
     ln -s <git path inside mirror> <Reference that must appear in gerrit>  Example: ln -s /home/repouser/gitrepos/simt_mirror/platform/vendor/sonim/NetworkSelection.git simt_mirror/platform/vendor/sonim/NetworkSelection.git 
  8. Restart the gerrit services.
  9.  cd ~/gerrit-home/git.
    ~/gerrit-home/bin/gerrit.sh restart  
    Output 1: Stopping Gerrit Code Review: OK  
    Output 2: Starting Gerrit Code Review: OK 
  10. Login with your user id in a new window, to have a branch requested for this repo, for example: 8926-X700-10152-BELL-MR1-MSI1.
  11.  mkdir create_branch_for_<git repo/project name>  
     Example : mkdir create_branch_for_NetworkSelection 
  12. Clone the project ( empty repo) in your directory in your home directory.
  13.  git clone repouser@10.15.1.31:/home/repouser/gitrepos/<mirror>/<path> . 
     git clone repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/vendor/sonim/NetworkSelection 
  14. Set the branch inside the new project.
  15.  cd <cloned directory> <pre> Example : cd NetworkSelection 
  16. Set the branch to the requested branch.
  17.  git checkout -b <new-branch-requested for empty git repo> 
     Example: git checkout -b 8926-X700-10152-BELL-MR1-MSI1
  18. Touch a readme file in the directory.
  19.  touch Readme.txt 
  20. Add the newly added file.
  21.  git add Readme.txt 
  22. commit the Readme file.
  23.  git commit -am "Committed readme.txt file 
  24. Run git status and git log to see if your commits are proper and visible.
  25. To get the remote repo info run git remote -v being inside the NetworkSelection cloned directory.
  26.  git remote -v 
  27. Push the commit to the empty repo on the requested branch.
  28.  git push <remote repo> <requested branch> 
     Example : git push  origin 8926-X700-10152-BELL-MR1-MSI1
    Note: <remote repo> is the output of the command git remote -v.
  29. Add entry to the manifest file. To make an entry to the manifest file for the new repo, create a workspace using your id.
  30.  repo init -u repouser@10.15.1.31:/home/repouser/gitrepos/<mirror-name or path>/platform/manifest -b <repo branch> 
     repo Example: init -u repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/manifest -b 8926-X700-10152-BELL-MR1-MSI1 
     cd to the .repo/manifests directory and set the branch.
     cd .repo/manifests 
     git checkout  <branch on which new repo was created> 
     Example: git checkout 8926-X700-10152-BELL-MR1-MSI1
    Edit the default.xml file and create an entry where similar directory structures are present for the new repo, using the vi editor. For example, to add an entry for repo * SonimSetupWizard under platform/vendor/sonim/, use the following entries. Search for entries that are present, based on the directory paths mentioned and add * accordingly. Save the changes in the vi editor.
     vi default.xml 
        "<project name="platform/vendor/sonim/SonimSetupWizard" path="vendor/sonim/SonimSetupWizard"/>
    Commit changes to local repository.
     git commit -am "Added new empty repo  <repo-name> to branch <branch-name> 
     Example: git commit -am   "Added new empty repo  SonimSetupWizard to branch 8926-X700-10152-BELL-MR1-MSI1 
     Push the manifest branch to remote repository
     git push origin <branch_name>  
     Example: git push origin 8926-X700-10152-BELL-MR1-MSI1 
  31. Verify that the newly created empty git repo on the requested branch is properly created, using following steps: Login to your user account and test if the repo sync of the new project completes successfully.
  32.  Example line1:  mkdir test 
     Example line2:  cd test/ 
     repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b <branch-name>    
     Example : repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b 8926-X700-10152-BELL-MR1-MSI1    
     repo sync "newly created repo/project" 
     Example: repo sync "platform/vendor/sonim/NetworkSelection"