fixed ssh-keygen issue

This commit is contained in:
marvzhang
2020-02-18 15:20:57 +08:00
parent 06f1d6a8ac
commit 51a01e1f32
3 changed files with 8 additions and 7 deletions

View File

@@ -2,4 +2,5 @@
logs
*.log
dist/
**/node_modules/
**/node_modules/
**/tmp/

View File

@@ -312,12 +312,9 @@ func GetGitSshPublicKey() string {
if !utils.Exists(path.Join(os.Getenv("HOME"), ".ssh")) ||
!utils.Exists(path.Join(os.Getenv("HOME"), ".ssh", "id_rsa")) ||
!utils.Exists(path.Join(os.Getenv("HOME"), ".ssh", "id_rsa.pub")) {
cmd := exec.Command(fmt.Sprintf("ssh-keygen -q -t rsa -N \"\" -f %s/.ssh/id_rsa", os.Getenv("HOME")))
if err := cmd.Start(); err != nil {
log.Errorf(err.Error())
debug.PrintStack()
return ""
}
log.Errorf("no ssh public key")
debug.PrintStack()
return ""
}
content, err := ioutil.ReadFile(path.Join(os.Getenv("HOME"), ".ssh", "id_rsa.pub"))
if err != nil {

View File

@@ -29,5 +29,8 @@ then
/bin/sh /app/backend/scripts/install-nodejs.sh
fi
# generate ssh
ssh-keygen -q -t rsa -N "" -f ${HOME}/.ssh/id_rsa
# start backend
crawlab