@@ -139,14 +139,19 @@ install_nvm_from_git() {
139139    fi 
140140  fi 
141141
142+   local  remote
143+   remote=" $( git config --global clone.defaultRemoteName ||  true) " 
144+   if  [ -z  " $remote " ;  then 
145+       remote=origin
146+   fi 
142147  local  fetch_error
143148  if  [ -d  " $INSTALL_DIR /.git" ;  then 
144149    #  Updating repo
145150    nvm_echo " => nvm is already installed in $INSTALL_DIR , trying to update using git" 
146151    command  printf  ' \r=> ' 
147152    fetch_error=" Failed to update nvm with $NVM_VERSION , run 'git fetch' in $INSTALL_DIR  yourself." 
148153  else 
149-     fetch_error=" Failed to fetch origin  with $NVM_VERSION . Please report this!" 
154+     fetch_error=" Failed to fetch $remote  with $NVM_VERSION . Please report this!" 
150155    nvm_echo " => Downloading nvm from git to '$INSTALL_DIR '" 
151156    command  printf  ' \r=> ' 
152157    mkdir -p " ${INSTALL_DIR} " 
@@ -156,9 +161,9 @@ install_nvm_from_git() {
156161        nvm_echo >&2  ' Failed to initialize nvm repo. Please report this!' 
157162        exit  2
158163      }
159-       command  git --git-dir=" ${INSTALL_DIR} /.git" origin  " $( nvm_source) " 2>  /dev/null \
160-         ||  command  git --git-dir=" ${INSTALL_DIR} /.git" origin  " $( nvm_source) " ||  {
161-         nvm_echo >&2  ' Failed to add remote "origin " (or set the URL). Please report this!' 
164+       command  git --git-dir=" ${INSTALL_DIR} /.git" " $remote " " $( nvm_source) " 2>  /dev/null \
165+         ||  command  git --git-dir=" ${INSTALL_DIR} /.git" " $remote " " $( nvm_source) " ||  {
166+         nvm_echo >&2  ' Failed to add remote "' " $remote " ' " (or set the URL). Please report this!' 
162167        exit  2
163168      }
164169    else 
@@ -170,10 +175,10 @@ install_nvm_from_git() {
170175    fi 
171176  fi 
172177  #  Try to fetch tag
173-   if  command  git --git-dir=" $INSTALL_DIR " " $INSTALL_DIR " origin  tag " $NVM_VERSION " 2> /dev/null;  then 
178+   if  command  git --git-dir=" $INSTALL_DIR " " $INSTALL_DIR " " $remote " " $NVM_VERSION " 2> /dev/null;  then 
174179    : 
175180  #  Fetch given version
176-   elif  !  command  git --git-dir=" $INSTALL_DIR " " $INSTALL_DIR " origin  " $NVM_VERSION " ;  then 
181+   elif  !  command  git --git-dir=" $INSTALL_DIR " " $INSTALL_DIR " " $remote " " $NVM_VERSION " ;  then 
177182    nvm_echo >&2  " $fetch_error " 
178183    exit  1
179184  fi 
0 commit comments