Better Repository Management System for Developers
Use "ghq" to manage repositories properly

Software Engineer | Java | Spring | MSc. in Big Data Analytics | Salesforce IAM Architect | IAM Expert | AWS SAA | AWS DVA | Hashicorp Terraform Certified
๐๐ผ Introduction
If you are a developer then a VCS(Version Control System) like GitHub or GitLab is one of the most important tools you are using. When you want to clone a git repo, you might be copying the HTTPS link or SSH link and typing the following in your terminal.
git clone <REPO_URL>
The only problem involved in this case is, you are just cloning the git repo manually and there can be several problems due to that. Some of them are,
You are just cloning the repository to whatever place you like and when you need it, you cannot find it easily.
There can be multiple copies of the same repository in several places on your machine and you can get tedious in tracking them.
If you have repositories with the same name cloned from different developers or different VCSs, you may not have a mechanism to track them properly.
So how can we have a proper system in our machine to track our local repositories?
๐ป ghq
The answer is using a tool like ghq. It is a command line tool that provides a way to manage the remote repositories in your local machine hierarchically so that you won't have the aforementioned problems.
To install ghq you can simply use the following instructions.
MacOS
โณ
brew install ghqVoid Linux
โณ
xbps-install -S ghqGNU Linux
โณ
guix install ghqWindows + scoop
โณ
scoop install ghqgo get
โณ
go installgithub.com/x-motemen/ghq@latestconda
โณ
conda install -c conda-forge go-ghqbuild
โณ
git clonehttps://github.com/x-motemen/ghq. make install
After installing ghq we need to configure it using ~/.gitconfig file, so that we can store all the cloned repositories in one directory. To do that, create a .gitconfig in the root directory if not present by running the following command.
vi ~/.gitconfig
Then, add the following configurations there.
[user]
name = <username>
email = <email>
[ghq]
vcs = git
root = <directory_path>
After that, you can simply clone a repository using,
ghq get <REPO_URL>
And the repository will be cloned to the directory you have configured in ghq.root in .gitconfig file. And, you will notice that it will be cloned properly with,
vcs name โ user name โ repo name
There are additional configurations you can use if you are using multiple VCS systems and you can find them in the official documentation[1].




