简体   繁体   English

创建新分支时无法从 jenkins 推送 git

[英]Unable to do git push from jenkins when creating a new branch

I am creating a new git branch from Jenkins (execute shell) using the below commands but when I run this job, it creates the branch locally but doesn't push it to the origin.我正在使用以下命令从 Jenkins(执行 shell)创建一个新的 git 分支,但是当我运行此作业时,它会在本地创建分支但不会将其推送到原点。 Also this Jenkins job just stuck at the git-push command and never completes.此外,这个 Jenkins 作业只是卡在 git-push 命令上并且永远不会完成。 I think I am missing something somewhere due to which it is not able to push.我想我在某个地方遗漏了一些东西,因为它无法推动。

git fetch origin old-branch:new-branch git checkout new-branch git push -u origin new-branch git fetch origin old-branch:new-branch git checkout new-branch git push -u origin new-branch

Did I missed anything?我错过了什么吗? Any suggestions?有什么建议么?

The commands you have mentioned are correct and there seems to be no issue in that.您提到的命令是正确的,似乎没有问题。

git fetch origin master:newbranch 
git checkout newbranch 
git push -u origin newbranch

In this particular order.按照这个特定的顺序。

Please check is the user with which Jenkins jobs are running has sufficient privileges to create branch in the git repository.请检查运行 Jenkins 作业的用户是否有足够的权限在 git 存储库中创建分支。

And by stuck what do you mean, does it timeout or gives any error.卡住是什么意思,它是超时还是给出任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建新分支时git push origin自动合并到master - Git push origin when creating a new branch automatically merges into master 如何从詹金斯工作推到Git分支? - How to push to Git branch from Jenkins job? 忘记在上一个分支上执行“ git push”并开始新的分支 - Forgot to do 'git push' on previous branch and started new branch 为什么从分离的HEAD创建新的远程分支的git push语法如此不同? - Why is the git push syntax for creating a new remote branch from a detached HEAD so different? Git:如何从“无分支”推送到新的远程分支? - Git: How to push from “no branch” to a new remote branch? 在Git中的分支上创建一个新分支 - Creating a new branch on a branch in Git 从git中的现有分支创建新分支时如何不触发管道? - How to not trigger pipeline when creating a new branch from an existing branch in git? 在 Visual Studio 中从过去的提交创建新的 git 分支时,如何处理数组越界异常? - How do I deal with the array out of bounds exception when creating a new git branch from a past commit in Visual Studio? 如果我从另一个分支推送,是否会在 git 分支上提交? - Will a commit on a git branch follow if I do a push from another branch? Gitkraken / Github / git:从非父分支创建新分支 - Gitkraken / Github / git: creating new branch from a non parent branch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM