We use cookies to help us improve our webpage. Please read our Cookie Policy .

NAS 245

Introduction to Git

Configuring a Git repository on your ASUSTOR NAS

2023-08-11

COURSE OBJECTIVES

Upon completion of this course you should be able to:

  1. Configuring a Git repository on your ASUSTOR NAS.

PREREQUISITES

Course Prerequisites:

None

Students are expected to have a working knowledge of:

Linux, Git


OUTLINE

1. Introduction to Git

1.1 Installing Git on an ASUSTOR NAS

2. Configuring a Git Repository on your ASUSTOR NAS

2.1 Creating a Shared Folder for Git Repositories

2.2 Configuring Git Repositories

3. Connecting to a Git Repository on your NAS with other Git tools





1. Introduction to Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

The advantage of the distributed version control system is that Git can still be used locally in an environment without a server or without a network. When a server or a network returns to normal, data will synchronize itself.



1.1 Installing Git on an ASUSTOR NAS


  • Log into ADM with an admin account.
  • Search for Git on App Central.
  • Select Git, click Install.
  • Git only supports command-line operations through SSH, so after installation is complete, the ADM desktop icon will not appear.




2. Configuring a Git Repository on your ASUSTOR NAS

Git provided by ASUSTOR only runs using accounts with administrator rights. Before using Git, ASUSTOR recommends that creating a new shared folder to manage all files in a Git Repository in a unified manner.



2.1 Creating a Shared Folder for Git Repositories


  • Select [Access Control] [Shared Folders].
  • Click on [Add].


  • You are now ready to create a new shared folder on your NAS.
  • Enter a name for the new folder and click [Next] once you are done. (In the example below, we have entered "Git_Repository" as the name of our new folder).


  • Set access rights for the folder by selecting the radio button corresponding to the access rights of your choice. (In the example below, the access rights [Read Only for all users, Read & Write for administrators] that have been selected.)
  • Once you're done, click [Next].


  • Review a final summary of your settings.
  • Once you're done, confirm these settings by clicking [Finish].



2.2 Configuring Git Repositories

Git only supports command-line operations, please first ensure that SSH has been enabled.


  • Select [Services] [Terminal] [SSH].
  • Select [Enable SSH service] and click on [Apply].


  • Use an SSH client to log into your NAS and navigate to the shared folder named Git_Repository.
  • Input the command to create a new folder, usually named with the Git project. You can also create a new folder in the ADM File Explorer.
  • $ mkdir TestProject


  • Go to the created Git project folder and enter the following command to initialize the Git repository.
  • $ git init -- bare


  • When the Git Repository has been initialized, you’ll be able to see that the Git repository has been set up in ADM File Explorer.




3. Connecting to a Git Repository on your NAS with other Git tools

Users can install appropriate software on other platforms which also support Git to clone the Git repository from an ASUSTOR NAS and then modify and commit source code on different platforms.

Please refer to the Git official website to download and install Git for Windows.


  • After Git is installed, open Windows File Explorer and create a new folder to manage Git. The folder name "Git_Clone" is used for the purposes of this guide.


  • Right-click on the blank space on the right side of the Git_Clone folder and select [Open Git Bash here].


  • Use the Git clone command to connect to the Git repository on the NAS and clone the source code of a project.
  • $ git clone ssh://admin@{NAS_IP}/volume2/Git_Repository/TestProject
  • Log into your NAS with the password you use for your admin account in ssh.
  • After the Git clone is completed, you’ll be able to modify, write and commit source code on the local platform.


Instructions for Git Gui:

  • Right-click on the blank space on the right side of the Git_Clone folder and select [Open Git GUI here].


  • Click on [Clone Existing Repository].


  • Input the NAS Git repository as the source location.
  • Input local folder as the Target Directory.
  • Click Clone to clone the source code of a Git project.


  • Log into your NAS with the password you use for your admin account in ssh.


  • After the Git clone is completed, you’ll be able to modify, write and commit source code on the local platform.


Using TortoiseGit:

  • Right-click on the blank space on the right side of the Git_Clone folder and select [Git Clone…].


  • Input the NAS Git repository as the URL.
  • Input local folder as the Target Directory.
  • Click OK to clone the source code of a Git project.


  • Log into your NAS with the password you use for your admin account in ssh.


  • After the Git clone is completed, you’ll be able to modify, write and commit source code on the local platform.

Was this article helpful? Yes / No