Syncing SecureCRT sessions via a Git Repository

Introduction

This guide will walk you through how to clone a SecureCRT session repository to your local machine and keep it updated with contributions from your peers.

Getting Started

Glossary of helpful terms:

  • Clone –> Pulls a copy of the repository onto your local machine
  • Fetch –> Find’s out which objects or changes are missing from your local database and downloads them
  • Merge –> Bring the cotents of another branch into your local database
  • Pull –> Does a Fetch and Merge
  • Push –> Find’s out which objects or changes are missing from the Git repository and uploads them
  • Stage –> Prepare your local database changes for a Commit
  • Commit –> A single point in the Git repository history. A Commit can be thought of as a new "version" of the Git repository
  • Sync –> An all-in-one command. Does a Pull and Push

Helpful Links

BEFORE YOU BEGIN

It is EXTREMELY IMPORTANT that you ‘store your personal data separately’ in SecureCRT before you start using the SecureCRT session repository. If you fail to do this step, you will sync all your personal information (usernames and passwords) with everyone that uses this repository.

  1. Open SecureCRT and navigate to Options -> Global Options -> Configuration Paths
  2. Close SecureCRT. When it asks if you would like to separate your data now, say ‘Yes’

Creating your Git Repository

To create your initial git repository, choose your favorite git hosting solution and create a new repository named with something that is easy for everyone to know what it is and what it’s for, i.e. Network_Engineering_CRT_git.

Getting ready to use Git Repositories

  1. Download and install Git and accept all defaults

  2. Open a Command Prompt (or Terminal) and set your Git username and email by entering the following:

    git config --global user.name "Firstname Lastname"
    git config --global user.email "first.last@email.com

  3. Download and install Visual Studio Code or whichever client you prefer

Clone the Git Repository to your local database

  1. Open a broswer and navigate to the repository you want to clone (See Helpful Links above)
    • In Azure Repos, click the Clone button in the top right
    • In Github, click the Code button in the top right
  2. Copy down the repository URL and if in Azure Repos, click Generate Git Credentials
  3. Open Visual Studio Code and Clone the repo by:
    • GUI: In the left pane, click the Source Control button, then click the and select Clone
    • CLI: Windows users press ctrl+shift+p and Mac users press command+shift+p to open the VS Code command prompt and type git clone and hit enter
  4. VS Code will open a command drop-down asking for the URL of your repository. Copy and paste the URL from step 3 into here and hit enter.

This part is very important!

  1. When VS Code asks you where you want to save your local database, you MUST save it in the following location (unless you manually saved your sessions somewhere else):
    • Windows: C:\Users\username\AppData\Roaming\VanDyke\Config\Sessions
    • Mac: /Users/username/Library/Application Support/VanDyke/SecureCRT/Config/Sessions
  2. If cloned from Azure Repos, you will get a prompt to enter your password. This password is the one from step 3 Generate Git Credentials
  3. Once authenticated, VS Code will now clone the repository into a local database. It should be empty because we haven’t added anything to it yet.

Using the Git SecureCRT sessions

Now browse to where your current sessions are located (see above), and copy and paste all your current sessions into your new local git database folder you just created. Once copied to the git folder, we want to now commit our changes and sync them to the main repository:

  • GUI: In the left pane, click the Source Control button, then click the and select Commit, it will ask you for a commit message. Enter something descriptive of what your changes were for.
  • CLI: Open the VS Code command prompt and type git commit and enter a commit message. Enter something descriptive of what your changes were for. Then again in the VS Code command prompt type git sync.

Now you can open SecureCRT and you will see the Main Git Repository folder in your sessions. Be sure to do a git pull whenever someone makes changes to ensure your local database is always up-to-date.

Contributing to the repository

Now that everyone has a local copy of the main repository, you can now make new sessions, delete sessions, edit sessions, etc. in any way you’d like.

Examples:

  • Directly in SecureCRT
  • Directly to files and folders in your directory
  • In VS Code

Updating the main repo with your changes

Once you’ve completed your changes, update the main repo by:

  • GUI: In the left pane, click the Source Control button, then click the and select Commit, it will ask you for a commit message. Enter something descriptive of what your changes were for.
  • CLI: Open the VS Code command prompt and type git commit and enter a commit message. Enter something descriptive of what your changes were for. Then again in the VS Code command prompt type git sync.

You can browse to the Git repository URL to see if your changes successfully synced.

Syncing changes made by others

To make sure you have the latest changes made by your peers, be sure to run git pull every once in a while, or if someone announces that they’ve updated the repository. Getting these changes to show up in SecureCRT will require your to close and re-open the SecureCRT.

Source Control

You can also set this repo up with some guard rails, i.e. changes have to be peer reviewed and accepted before they will be merged into the main repo. This is done by using separate ‘branches’. I won’t go over that here just yet, but will update this in the near future on how my organization utilizes branches to ensure the main repo only has the sessions and info we want to share to everyone in it.

Closing

This way of doing it was literally myself and a few others on my team clunking our way around, trial-and-error style, until we got something that works for us. If you have suggestions on how to make this process a little better, please share it so we all can benefit!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s