func (r *Repo) gitCmdWithKey(params []string, dir string) error {
	var gitSSH, script gitos.File
	// ensure temporary files deleted after usage
	defer func() {
		if gitSSH != nil {
			gos.Remove(gitSSH.Name())
		}
		if script != nil {
			gos.Remove(script.Name())
		}
	}()

	var err error
	// write git.sh script to temp file
	gitSSH, err = writeScriptFile(gitWrapperScript())
	if err != nil {
		return err
	}

	// write git bash script to file
	script, err = writeScriptFile(bashScript(gitSSH.Name(), r, params))
	if err != nil {
		return err
	}

	return runCmd(script.Name(), nil, dir)
}
func (r *Repo) gitCmdWithKey(params []string, dir string) error {
	var gitSSH, script gitos.File
	
	defer func() {
		if gitSSH != nil {
			gos.Remove(gitSSH.Name())
		}
		if script != nil {
			gos.Remove(script.Name())
		}
	}()

	var err error
	
	gitSSH, err = writeScriptFile(gitWrapperScript())
	if err != nil {
		return err
	}

	
	script, err = writeScriptFile(bashScript(gitSSH.Name(), r, params))
	if err != nil {
		return err
	}

	return runCmd(script.Name(), nil, dir)
}
func ( r * Repo ) gitCmdWithKey ( params [ ] string , dir string ) error { var gitSSH , script gitos . File // ensure temporary files deleted after usage defer func ( ) { if gitSSH != nil { gos . Remove ( gitSSH . Name ( ) ) } if script != nil { gos . Remove ( script . Name ( ) ) } } ( ) var err error // write git.sh script to temp file gitSSH , err = writeScriptFile ( gitWrapperScript ( ) ) if err != nil { return err } // write git bash script to file script , err = writeScriptFile ( bashScript ( gitSSH . Name ( ) , r , params ) ) if err != nil { return err } return runCmd ( script . Name ( ) , nil , dir ) }
// gitCmdWithKey is used for private repositories and requires an ssh key.
// Note: currently only limited to Linux and OSX.
gitCmdWithKey is used for private repositories and requires an ssh key . Note : currently only limited to Linux and OSX .