Skip to content

List gitlab projects and clone selected to current directory

Notifications You must be signed in to change notification settings

szunaj13pl/shell-gitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab in shell

testing on Ubuntu 16.04 PASS

Search and clone Gitlab project directly from shell with nice and clean GUI.

Clone selected projects to current directory.

Usage

gitlab <string> - Return list of projects matching the search criteria

gitlab -c - Edit configuration

gitlab -u - Self update

gitlab -d - Enable debuging mode

Configuration

Run gitlab -c to edit configuration ~/.config/gitlab/config

variable name value exemple
autoupdate (default) true
Check update once prer day
autoupdate=true
GITLAB_URL Gitlab HTTPS address GITLAB_URL=gitlab.company.com
GITLAB_PRIVATE_TOKEN Personal Access Token
Scopes api (Access your API)

https://<GITLAB_URL>/profile/personal_access_tokens
GITLAB_PRIVATE_TOKEN=verySecretToken123

Requrments

command description
git free and open source distributed version control system.
curl command-line tool for transferring data specified with URL syntax
jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data
dialog generate the dialog boxes inside terminal

Instalation

via curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/szunaj13pl/shell-gitlab/master/install.sh)"

via wget

sh -c "$(wget https://raw.githubusercontent.com/szunaj13pl/shell-gitlab/master/install.sh -O -)"

or step by step

    # Install requirements

        sudo apt install git jq dialog curl


    # Create tempormaly folder for clean instalation
    
        temp_gitlab_folder=$(mktemp -d /tmp/gitlab.XXXXXX)
    
    
    # Download project
    
        git clone https://github.com/szunaj13pl/shell-gitlab.git "$temp_gitlab_folder"\
        && cd "$temp_gitlab_folder"
    
    
    # Create 'bin' folder and copy script to it
    
        mkdir -p $HOME/bin
        cp gitlab $HOME/bin
    
    
    # Add 'bin' folder to $PATH
    
        echo "$PATH"| grep --quiet "$HOME/bin" \
        && echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.profile
    
    
    # Create configuration folder and copy 'default_config' to it
    
        mkdir -p $HOME/.config/gitlab
        cp default_config $HOME/.config/gitlab/default_config
        cp --no-clobber default_config $HOME/.config/gitlab/config
    
    # Now you can use 'gitlab' like command
    
    
    # Clean-up
    
        rm  -rf "$temp_gitlab_folder"

    # DONE! Now you can use 'gitlab' like command