Unable to retrieve git submodule in jenkins with git-client plugin - windows

I'm trying to have Jenkins retrieve the submodules of a repository, but I cannot get it to work. I've looked around on the internet for a solution, but most problems there center around authentication, which is not the issue in this case. From what I've been able to gather from the error message, the issue seems to be related to the way the git-client plugin handles reponses from the command-line tools.
As we had Git for Windows version 2.6.0 installed and the Jenkins Git-client plugin 'officially' supports version 2.5.0, I also tried uninstalling version 2.6.0 and installed version 2.5.0, but that made no difference.
Does anyone here have any experience with this problem or a possible solution?
The error is:
FATAL: Command "c:\Program Files\Git\bin\git.exe submodule update" returned status code 1:
stdout:
stderr: Cloning into 'mysubmodule'...
error: cannot spawn echo : No such file or directory
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'http://somerepo': No error
Clone of 'http://somerepo/scm/bf/mysubmodule.git' into submodule path 'mysubmodule' failed

I have experienced the very same error, with same version of Git and Jenkins Git-client plugin.
It appears that this could be a combination of a bug and a misconfiguration of the submodule(s) in the .gitmodules file of the main repository. And the error message is definitely not as helpful as it could be!
In my case the .gitmodules file in the main repository contained the absolute url path to the submodule. This caused Jenkins to not be able to authenticate properly for the submodule. Changing the submodule path to be relative (../mysub.git) fixed it for me.
This helped me quite a lot:
https://issues.jenkins-ci.org/browse/JENKINS-31244
I hope you find this helpful.

Related

Cannot execute Git commands from Gradle build script on Windows 10

I have recently forked and cloned a repositroy from GitHub that uses Gradle, but I am unable to execute any Gradle tasks.
It fails on:
def process = 'git rev-parse --short HEAD'.execute()
with:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Joseph\Desktop\Minecraft\ObsidianSuite\ForgeGradle\ForgeGradle\build.gradle' line: 286
* What went wrong:
A problem occurred evaluating root project 'ForgeGradle'.
> Cannot run program "git": CreateProcess error=2, The system cannot find the file specified
I am running Windows 10, and have Git working with MinGW. I have set the path variable to include (C:\Program Files\Git\cmd) such that I can run Git from command prompt. The Git command that is called by the build.gradle file executes fine if I run it from the command line, it is just not working when run through the Gradle wrapper.
Any help or advice would be much appreciated; I am able to answer any questions that might help work out what the issue is. Thanks.
EDIT: I normally use Git by running git-bash in the relevant folder rather than git from command prompt.
I have found a solution, it doesn't provide an answer to why it wasn't working originally, but gives a work around.
I followed this answer to install GitHub for Windows and changed the old Git path variable to the one the tutorial suggested. Although I don't want to use the GitHub software (I like doing everything via git-bash), at least Gradle is happy with it now.
Not sure if this is the same problem.
I am using Android studio here. When gradlew build is executed, def process = 'git rev-parse --short HEAD'.execute() returns empty, but there is no problem in local execution.
Solution:
The solution is: modify the jdk path used by gradlew, use java jdk. (Do not use the sdk that comes with android studio)
Screenshot:
enter image description here
Please, don't call executables from Java/Groovy/Gradle/etc. There are many java/groovy libraries to deal with Git repositories, including Gradle plugins

How do I get around "Filename too long" error when running `chef install` on Windows 10?

I'm transitioning from berkshelf to the Policyfile workflow, and everything was running fine until I attempted to resolve all the dependencies. Two of my dependencies are from git, so when I run chef install in the cookbook directory, I get the following error:
Error: Failed to generate Policyfile.lock
Reason: (CookbookOmnifetch::GitCommandError) Git error: command `git reset --hard 7e5e4bccf57718cacc246f1b4d501ff7de8ac13d` failed. If this error persists,
try removing the cache directory at 'C:/Users/pcummuskey/AppData/Local/chefdk/cache/.cache/git/780b7dbee933c3a9efbfd3898d54cdf72784fa7e'.Output from the command:
error: unable to create file test/kitchen/.kitchen/tmp/librarian/cache/source/chef/site/877777683730772c36b1e6a3fc3aa2c3/windows/version-uri/a3432e93fb3c21cb7111fde71e435661/package/files/default/handlers/windows_reboot_handler.rb: Filename too long
Checking out files: 100% (389/389), done.
fatal: Could not reset index file to revision '7e5e4bccf57718cacc246f1b4d501ff7de8ac13d'.
Predictably, removing the cache folder had zero effect on the problem. I'm in the middle of checking whether I can get it working in the ubuntu subsystem and/or docker atm, but it'd be nice to be able to run it natively on Windows.
I don't get this problem using "git bash" (MINGW64) packaged in Git for windows installer.
As an example:
$ pwd
/c/Users/foobar/AppData/Local/chefdk/cache/.cache/git/13036489648c6f8811262c6a50ff6b03da2395b7/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f6/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f61
Managed to work around the issue by making a local cookbooks folder and checking out the dependencies to there and referencing them by path. It's not pretty, but it does the trick.

Bundler error message "Revision master does not exist in the repository"

When trying to install the gem "u2f" from the repo at "castle/ruby-u2f" I get an error message:
Fetching git://github.com/castle/ruby-u2f.git
fatal: Needed a single revision
Revision master does not exist in the repository git://github.com/castle/ruby-u2f.git. Maybe you misspelled it?
I cannot find any information about this error message. The text does not appear in any of the bundler source files, so I don't even know where to start debugging.
If anyone has any insight into the source and cause of this error, I'd love to know.
If you're trying to install a gem from a github source and got this, it may be because the repo changed its default branch from "master" to "main". Try adding branch: 'main' and see if it works.
Try pulling from the master branch
I git pull a project to the local (on MacOS), and almost the same problem occurred during the bundle install. But I tried the above answers to no avail.

rubymine commit failed with errors

After pulling from main master, encountering a conflict and resolving conflict.
I'm working in a sub-folder of the main project repo (on automated tests) and so generally don't have to worry about conflicts. It seems however that every time a conflict is encountered and fixed, where I attempt to commit the pulled files RubyMine gives me this error message and won't allow anything to be done to resolve. I've previously taken a new fork from the GitHub main and manually merged in my own lost commits but it's happened again.
I can't find any reference to this dialog on searching the web and our TA has investigated the issue, concluding that it may be a RubyMine bug. I'm continuing my search for relevant info but aside from poring through the bugs in http://youtrack.jetbrains.com/issues/RUBY (which I have now done with no relevant issues found) I can't see where any leads might come from.
Latest version of RM (6.0.3) running on Macbook Pro (Mavericks)
RubyMine was used to resolve the conflicts; git status shows only the pulled files I'm now trying to commit as tracked and uncommitted - I have untracked files managed in a gitignore file
The dialog says:
Commit
Commit failed with errors
With error message displayed in terminal:
Error: Error executing git commit --only -F
[list of files I attempted to commit]
Try like this
Goto Tools -> Open terminal
Use this command
git status
Then add untracked files
git add .
Commit changes like this
git commit -i * -m "commit message"
If you still have errors please post the error. You can see the Version control logs at the bottom of rubymine
Are you using Rubymine to resolve the conflicts? If not, it's possible RubyMine has kept stale state of the filesystem and is reporting the errors because of this.
What does git status . tell you in your working directory? Is your current tree clean, or do you have unmerged changes?

Ubuntu Subversion with Windows Client

I installed subversion on my Ubuntu server and I can use subclipse (1.6) in Eclipse Helios on Ubuntu and it works fine.
However when I try and use Subclipse (1.6) in Eclipse Helios on Windows, it doesn't work and I get errors.
In Windows when I use http://serverAddress/svn, I get an error saying folder doesn't exist and an error in the console saying:
Repository has been moved
svn: Repository moved permanently to 'http://serverAddress/svn/'; please relocate
When I use svn://serverAddress/svn, I get an issue as well.
Does anyone have any ideas?
This is not an Eclipse issue, but a SVN issue.
If you could see your repo in a web browser, the SVN FAQ mentions an httpd.conf error. But in your case:
either you haven't created a repository yet (see svnadmin create)
or you have a repo, but haven't create properly a directory in it, a bit like in this thread:
I then created a subdirectory "projectx" under ~/webapps/svn with subdirectories "trunk", "branches" etc and then ran:
$ svn import projectx file:///home/<user>/webapps/svn/projectx -m "first import".
projectx/trunk etc showed up fine on Trac, and https://svn.<user>.webfactional.com/projectx/ showed up fine in the browser, with proper authentication etc. All well and good.
However, when attempting to check out the project from trunk (using Tortoise SVN), I got this error:
Command: Checkout from https://svn.<user>.webfactional.com/projectx/trunk, revision HEAD, Fully recursive, Externals included
Error: Repository moved permanently to
Error: 'http://svn.<user>.webfactional.com/projectx/trunk/'; please relocate
With the solution being:
You've created directories on the filesystem below your repo, eg ~/webapps/svn/projectx. That's the wrong way.
You should instead use 'svn mkdir' to create the directories.
If this is not enough, see also this SO question, where it mentions that the repository address is usually http://servername/svn/repositoryname, not http://servername/svn.

Resources