• ssh-keygen -t rsa -C "<email-address>" Generate ssh-key
  • git init [dir] initialize from local
  • git init --bare [dir] Create a local bare repository
  • git clone <git-url> [dir] initialize from a remote repository
  • git clone [--branch tag-name/branch-name] <git-url> [dir] Download and bind the specified branch
  • git clone --bare <git-url> [dir] Clone the remote repository bare
  • git clone --mirror <git-url> [dir] Create a mirror repository
  • git remote set-url <remote-host-name> <new-git-url> Change remote repository address
  • Local repository initialization
    mkdir example
    cd example
    git init
    git remote add origin git@gitlab.com:trensy/cheatsheet.git
    #pull the remote branch
    git pull origin master 
    #Push data to the remote branch, or create a remote branch with the same name if it doesn't exist
    git push -u origin master 
    
  • Creating a local bare library
    mkdir example.git
    cd example.git
    git init --bare .
    
  • Push to new remote repository(1)
    git clone --bare git@gitlab.com:trensy/cheatsheet.git
    git remote add origin git@gitlab.com:trensy/cheatsheet_new.git 
    git push --mirror origin
    
  • Push to new remote repository(2)
    git clone --mirror git@gitlab.com:trensy/cheatsheet.git
    git remote update
    git remote add origin git@gitlab.com:trensy/cheatsheet_new.git
    git push --mirror origin
    
  • Modify remote repository address
    git remote set-url origin git@gitlab.com:trensy/cheatsheet.git