简体   繁体   English

为什么我会致命:文件来自Jenkins的存储库

[英]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.

相关问题 为什么我收到错误“致命:&#39;C:/ Program Files(x86)/ Git&#39;在存储库外”当我从存储库中运行“git reset --hard~1”时? - Why am I getting error “fatal: 'C:/Program Files (x86)/Git' is outside the repository” when I run “git reset --hard ~1” from within the repository? 为什么在 git 工作树中查找顶级目录时会出现“fatal: not a git repository...”? - Why am I getting `fatal: not a git repository...` when looking up toplevel dir in a git worktree? 即使我是它的所有者,也会出现错误“致命:不安全的存储库” - Getting error "fatal: unsafe repository" even though I AM the owner of it 为什么我会致命:身份验证失败<repo url></repo> - Why am I getting fatal: Authentication failed for <repo URL> 尝试从存储库中提取信息时,为什么会出现合并错误? - Why am I getting a merge error when trying to pull from my repository? 当我在git命令提示符下键入“ git add”时,收到致命消息,即不是git存储库。 - I am getting fatal message i.e not a git repository, when I am typing “git add .” in git command prompt. 将subversion存储库转换为git,为什么我看到“致命:不是有效的对象名称”? - Converting a subversion repository to git, why am I seeing “fatal: not a valid object name”? 我正在为存储库做出贡献,但在提交时显示“致命:不会添加文件别名” - I am contributing to an repository but " fatal: will not add file alias " is been shown while commit 致命的:无法使用jenkins从远程repository.error中读取 - fatal: Could not read from remote repository.error in using jenkins 当我运行git archive时,为什么会出现“远程:致命:找不到路径:HEAD”错误? - Why am I getting “remote: fatal: path not found: HEAD” error when I run git archive?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM