1.git拉取代码时如果使用系统用户,第一次拉取会弹出一个提示框,
实际现象:卡在GIT_SSH或git clone
jenkins给出的原因:By default, the Jenkins Windows installer sets up Jenkins to run as a service on Windows, which runs as the “Local System account”, NOT your user account. Since the “Local System account” does not have SSH keys or known_hosts set up, “git clone” will hang during the build.
意思其实就是jenkins本身会使用windows的系统用户,而不是当前安装打开jenkins服务器所使用的用户,所以会导致有一个对话框一直看不到
解决方案:
1.使用pstools进入系统用户命令行来解决这个问题
https://docs.microsoft.com/zh-cn/sysinternals/downloads/psexec
解压zip
进入文件夹打开命令行输入 PsExec.exe -i -s cmd.exe
进入系统命令行框后---"D:\Program Files\Git\usr\bin\ssh.exe" -T git@your.git.server
弹出Are you sure you want to continue connecting (yes/no)? 点击确认后jenkins那边就可以正常GIT 来去代码了
2.进入服务框找到jenkins,修改打开用户(概念方案没试过)