We have x86 Jenkins running on Windows Server 2016. No issues with pull of repo over ssh, both for projects and with git plugin in the pipeline.
Now I would like to be able to execute a 'git diff' command after a fetch from origin. I installed the Jenkins plugin "sshagent" and am attempting to execute the git commands from that context. From that plugins page it appears I no longer need to use Tomcat Native Libraries (quote: As of 1.14 unnecessary if ssh-agent is installed)
My direct issue is the error "Check if ssh-agent is installed and in PATH". I would prefer not to use Tomcat version if possible. I suppose I am trying to understand why every search I do implies ssh-agent.exe should be part of git, but it is not in my 'bin' folder.
Open to other ways to accomplish the stated goal (execute git diff), including foregoing ssh connection to the git server, but that also looks to be not straightforward.
This ended up being fairly straightforward, ssh-agent.exe was in git/usr/bin not git/bin. adding it to path per Druta suggestion resolved
Related
Recently master branch for Google repo tool has been updated to support Windows OS. It is clear from commit logs : https://gerrit.googlesource.com/git-repo/+log
I am able to run basic commands like repo init and repo sync using repo tool on Windows (which makes use of MinGW Git on Windows). In my work I need to create a local mirror of a repository and then use it. repo tool works fine to create mirror repository.
Here are commands used to create mirror repository on local drive on Windows OS.
$ repo.cmd init -u <URL> -b <branch_name> -m <manifest_file_name> --mirror --no-repo-verify
$ repo.cmd sync --no-tags
--no-repo-verify is used to forcefully use master branch of repo tool.
The above commands create the mirror in local drive C:\git-repo\test\mirror-testing\mirror
But when I refer the above mirror to sync in other drive then it shows error.
Command:
$ repo.cmd init -u <URL> -b <Branch_name> -m <manifest_file_name> --reference="C:\git-repo\test\mirror-testing\mirror" --no-repo-verify
Error:
error: object directory C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects? does not exist; check .git/objects/info/alternates.
The above command creates alternates file in C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects/info/ directory and that file contains below path:
C:\git-repo\test\mirror-testing\mirror\project/manifest.git\objects
I have tried other formats to provide reference value:
Git format: "/C/git-repo/test/mirror-testing/mirror"
Cygwin format: "/cygdrive/c/git-repo/test/mirror-testing/mirror"
Using above formats in reference does not create alternates file in objects directory.
repo init time in all above cases simply suggests that mirror is not referred and init is done from network.
When I repeat the same test with Cygwin Git + Google repo tool (stable branch) then I do not see any error and repo init time and sync time is very less compared to the mirror init and sync time, which simply suggests that mirror is referred.
repo.cmd is a batch file wrapper to invoke repo tool with python.
repo.cmd file contains single line
#call python %~dp0\repo %*
I am using Cygwin terminal in Windows 7 to run these commands.
To be clear repo init and repo sync shows error while referring to mirror but it completes successfully by syncing from outside network. The issue is that mirror is not referred.
Has anyone used Google repo on Windows for creating mirror and syncing in other drive using as reference?
I have tested Google repo tool master branch with MinGW Git on Windows 7 and Windows 10.
repo init and repo sync work on both OS.
Even creating the local mirror using --mirror is working, but referring that local mirror to sync in other drive does not work and displays error: "object directory not found".
To be clear using --reference with local mirror shows error, but it eventually uses the network and ignores the local mirror. Ultimately the command completes successfully, but it does not make the use of local mirror. I do not see any workaround for this on Windows for now.
Meanwhile Windows 10 supports Linux bash natively without using any VM.
WSL, the Windows Subsystem for Linux, is a free, optional feature of Windows 10 that allows Linux programs to run on Windows. It provides you with a Windows version of the bash shell and a compatibility layer that permits many Linux programs to run natively on your Windows machine. Using this option you can replace Cygwin Git with Linux Git.
I have tested repo tool on Linux Bash (with Ubuntu distribution installed) for repo init, sync, mirror and reference commands and it works. In fact we use Linux bash so simply Goole repo stable branch works, you do not need to use the master branch to make it work.
On a Windows (version 10) machine, with the latest git client at the time of writing (2.18.0.windows.1), cloning repositories using HTTPS fails with error:
git: 'remote-https' is not a git command.
After a bit of research it turns out that git comes with several remote-<command> utilities, with remote-https being one of them. The error message therefore seems to tell us that `remote-https is not installed on the machine.
After a bit more research, it seems that similar problems for other developers were solved by installing curl. The machine we're dealing with does have curl (7.46.0) installed as well.
We tried reinstalling the git client a couple of times entirely from git-scm.com as well as gitforwindows.org, both resulting in the same error.
Any help or pointer to get this fixed is highly appreciated.
I just fixed the error in my build env. hope my solution is useful to you.
my env: Windows10+Jenkins+git
git version 2.18.
I just reinstall the git into windows, with a different selection during the installation:"MINTTY". after reinstall, I found the remote-https under my git install directory.
also, you need to set the jenkins env. make sure that the new git path which was included in the Jenkins env configure. if you "echo %Path%", and you can find the new git path which included the remote-https, then you are fine.
I'm trying to use Git Extensions on a new Windows 7 machine. I have done that many times before but never hit this particular issue.
Git Bash is working, I successfully cloned a repository.
But going to Git Extensions, opening the repo, and doing a pull gives me the following error message:
"C:\Program Files (x86)\Git\bin\git.exe" pull --progress "origin"
error: cannot spawn git: Function not implemented
Done
Press Enter or Esc to close console...
My setup is very ordinary. The Git Extensions startup checks all pass. (This is similar but not the same problem as the common invalid path issue.)
Do you have any idea what causes this problem?
The new releases, Git for Windows 2.16.1(3) and Git for Windows 2.16.1(4), fix this regression:
2.16.1(3) Bug Fixes
When http.sslBackend is not configured (e.g. in portable Git or MinGit), fetch/push operations no longer crash.
On Windows 7 and older, Git for Windows v2.16.1(2) was no longer able to spawn any processes (e.g. during fetch/clone). This regression has been fixed.
The Perl upgrade in v2.16.1(2) broke git send-email; This has been fixed by updating the Net-SSLeay Perl module.
The mentioned regression in the second bullet point is exactly the error this question is about.
Unfortunately, there was one missing issue about spawning processes which was then fixed in the subsequent fourth release:
2.16.1(4) Bug Fixes
When called from TortoiseGit, git.exe can now spawn processes again.
Note that the download on https://git-scm.com/download/win might not have been update yet, so you need to download it from gitforwindows.org or directly from the release page on GitHub.
Afterwards, you can verify that you indeed running the new version using git --version which should report git version 2.16.1.windows.4.
Per Philippe and Jake - bug is filed against GIT 2.16.2, and workaround is to go back to prior version.
https://github.com/git-for-windows/git/releases/tag/v2.16.1.windows.1
Running an update on my machine to Git for Windows v2.21.0- just a slightly updated version fixed the issue with my Windows 7 installation at work.
https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-32-bit.exe
I cannot for the life of me seem to get my Jenkins CI to work with Github.
I had failure on the clone command, but that was due to keys, so I logged in as service account (the user Jenkins runs under as a Windows Service) and ran the clone command. All good in the hood.
However, when I want to run the fetch to get latest, it won't finish. It just sits there. I have tried via the Git plugin for Jenkins, and also via a Windows commandline script. Neither work. However, if I open a command prompt and type the command in, it works!
So how do I get it to work via Jenkins?
I run this script:
set
"C:\Program Files (x86)\Git\bin\git.exe" fetch -t ssh://git#github.com/OrgName/MyRepo.git +refs/heads/*:refs/remotes/origin/*
exit 0
and it sticks on the fetch command, never exiting.
Does someone have any suggestion?
It looks like msysGit stuck trying to find one of its components, used during fetch operation.
The Git itself not a single executable actually. It's a set of small tools doing their job great only being put together. Running Git on Windows from bash prompt makes it happen, but when you're running via Windows command prompt or in batch-files, the Force may not be with you.
I think you should check wherever you installed msysGit with option "Run Git from Windows Command Prompt". In this case all needed parts of Git will be added to the system PATH variable and git.exe will be able to access it from batch files, thus it should fix your fetch statement.
I am very new to the terminologies: git, repository and cloning.
I was able to search them all online and get pretty good grip on each (pretty simple stuff!).
But what I am trying to figure out now is how to "run" these instructions:
Clone repository for app:
git clone git://github.com/SampleLink.git
Update submodules:
git submodule update --init
I am running Windows7. I tried to run init through command prompt, but no luck.
Are these supposed to be run as individual commands or as one following the other in sequence automatically?
I am just not sure how to run these on my Windows machine and cannot seem to get any of it to work.
The submodule is a file within the initial repository.
I'm sorry if this is a lame question, but I have never needed to run this type of setup before.
I would recommend installing msysgit in its "Git for Windows" instance:
Git-1.7.3.1-preview20101002.exe
I like using Option 2, only adding the git\bin directory to the PATH environment variable, but without overriding some built-in windows tools.
From there, git clone over http should work.