[英]Why am I getting fatal: file is outside repository from Jenkins
I am trying to push a file on Git within a Jenkins job: 我试图在Jenkins工作中推送Git上的文件:
IN JENKINS I added a Windows shell command job and this is the first command: 在JENKINS中我添加了一个Windows shell命令作业,这是第一个命令:
git add "C:\Users\AMRABET\Documents\VSC\HW\index.html"
But I got the following error: 但是我收到以下错误:
fatal: C:\Users\AMRABET\Documents\VSC\HW\index.html: 'C:\Users\AMRABET\Documents\VSC\HW\index.html' is outside repository
Same command works from Windows CMD. 相同的命令适用于Windows CMD。 It works well from windows.
它适用于Windows。 My question is different because I only get it in Jenkins
我的问题不同,因为我只在詹金斯得到它
Any help? 有帮助吗?
As suggested in the comments I was just out of the git repo. 正如评论中所建议的那样,我刚刚退出git仓库。
Actually when in Jenkins you do 实际上在Jenkins你做的时候
cd C:\Location
AnotherShellAction
git add RandomFile
the git action will be executed not from C:\\Location you mentionned but from the default workspace. git动作不会从你提到的C:\\ Location执行,而是从默认工作区执行。 It means that you need to enter the wanted Location again after every instruction.
这意味着您需要在每条指令后再次输入所需的位置。 Good way would then be:
那么好的方法是:
cd C:\Location
AnotherShellAction
cd C:\Location
git add RandomFile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.