Is it possible to tell yarn that a repository has moved to a different location? - yarnpkg

I'm working on a web project that uses yarn. However, yarn install --verbose fails with
$ yarn install --verbose
yarn install v1.22.19
...
verbose 20.124766053 Performing "HEAD" request to "https://github.com/substack/esprima".
verbose 20.613087871 Request "https://github.com/substack/esprima" finished with status code 404.
verbose 21.844854143 Error: Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git#github.com/substack/esprima.git
Directory: /home/user/git/REDACTED/browser
Output:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at ProcessTermError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:721:66)
at ProcessTermError.MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:750:123)
at new ProcessTermError (/usr/local/lib/node_modules/yarn/lib/cli.js:790:113)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/yarn/lib/cli.js:25787:17)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Socket.<anonymous> (internal/child_process.js:444:11)
at Socket.emit (events.js:314:20)
at Pipe.<anonymous> (net.js:676:12)
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git#github.com/substack/esprima.git
Directory: /home/user/git/REDACTED/browser
Output:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
From what I can tell, yarn fails because the repo for the (indirect) dependency esprima has been removed. I'm guessing that https://github.com/jquery/esprima is the new location. The proper solution here is probably to update relevant dependencies but as this project hasn't been maintained in a few years it's really not something I want to do...
Therefore I wonder, is possible to tell yarn to use the new location without updating the dependencies?
I tried to redirect the git request with an insteadOf config which fixed the git error above but in the end it didn't fool yarn.

Related

How do I use go get with a private github enterprise server?

We use github enterprise server over a VPN.
If I type:
go get privateserver.com/path/to/myproject.git
I get this result:
package privateserver.com/path/to/myproject.git: cannot download, privateserver.com/path/to/myproject uses insecure protocol
Or removing the .git suffix I get:
package privateserver.com/path/to/myproject: unrecognized import path "privateserver.com/path/to/myproject" (parse https://privateserver.com/path/to/myproject?go-get=1: no go-import meta tags ())
It seems there are many similar questions on google searches but have found no answers that actually work.
What I really want to end up with is automation of docker builds.
Inside my docker file I require a go get. But I can't store the credentials inside the docker file.
Note: --insecure doesn't work. See bottom of question.
Just tried go get with -insecure -v options.
I get the following output:
matthewh#xen:~/go/src/$ go get -insecure -v privateserver.com/path/to/myproject.git
# cd .; git ls-remote git://privateserver.com/path/to/myproject
fatal: remote error:
GitHub private mode is enabled. Git protocol is disabled. Use authenticated http or ssh access instead.
# cd .; git ls-remote https://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote http://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote git+ssh://privateserver.com/path/to/myproject
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote ssh://privateserver.com/path/to/myproject
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
privateserver.com/path/to/myproject.git (download)
# cd .; git clone privateserver.com/path/to/myproject /home/matthewh/go/src/privateserver.com/path/to/myproject.git
fatal: repository 'privateserver.com/path/to/myproject' does not exist
package privateserver.com/path/to/myproject.git: exit status 128
The get command supports using http by using the -insecure flag as shown below:
go get -insecure privateserver.com/path/to/myproject.git
The default is secure HTTPS in order to prevent man in the middle attacks as described in Git Issue.

Unable to clone from GitHub enterprise in Jenkins

Jenkins build process fails with the following GIT error. And this seems to fail only for this GitHub Enterprise repository. If I try to do the same for GitHub repository, all ends well.
Building in workspace D:\Program Files(x86)\Jenkins\workspace\pullcodefromgithub
Cloning the remote Git repository
Cloning repository https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe init D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
ERROR: null
Finished: FAILURE
Note: This is not gitHub, but GitHub enterprise. Not sure how to fix it. No matter where I try - Mac or Windows, error is the same. Tried the same with SSH and that also fails
Started by user Ram
Building in workspace D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://githubenterprise.grangeinsurance.com/hmb/sail-server.git # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801)
... 11 more
ERROR: null
Finished: FAILURE
If I try to pull the contents of the repository from terminal or command prompt or git shell, it seems to work without any issues.
I am clueless to what is going on here. Any help or advice would be greatly helpful.
Thanks
This issue happens because of jenkins using "git" in stead of "jgit". This change will bring the universe back to sanity. Here's how we do it
Manage Jenkins-> Global configuration tool
Proceed to "git" section and Tap on "Add Git" drop down button, select JGit
Save your changes
Manage Jenkins -> Browse into your project/item -> Configure
Go into the repository configuration section
Git executable - change from default to jgit
Save your changes and proceed to build
This time, build should succeed. Happy building.

Can't get Jenkins to recognise a git repo

Trying to get Jenkins to run with Gradle etc. Please note that this is a Windows 10 OS. Not Linux.
I want to use a git repo on my local machine, under D:\temp\.git\. There is a file HEAD there.
On the "Source Code Management" page I enter the following in Repository URL:
file:///D:/temp/.git/
(NB I have played around a lot with the number (and type) of slashes here... nothing works)
The response comes:
Failed to connect to repository : Command "git.exe -c
core.askpass=true ls-remote -h file:///D:/temp/.git/ HEAD" returned
status code 128: stdout: stderr: fatal: '/D:/temp/.git/' does not
appear to be a git repository fatal: Could not read from remote
repository. Please make sure you have the correct access rights and
the repository exists.
I note that it says "from remote repository". Just wondering if it might be a question of tweaking something somewhere to specify a local repository... ?
Plus I also then tried running this same command at a DOS prompt without and then with Administrator rights:
D:\temp>git.exe -c core.askpass=true ls-remote -h file:///D:/temp/.git/HEAD fatal: Invalid gitfile format:
D:/temp/.git/HEAD fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
... which is puzzling. "invalid gitfile format" - what's that about? Plus the "access rights" thing: could it be that this is happening due to some nonsense to do with Windows UAC? But even with Admin rights I get the same message.
A bit later:
This command works at the command prompt, including as a non-administrator, if you omit the word "HEAD":
D:>git.exe -c core.askpass=true ls-remote -h file:///D:/temp
a4ca18f7b218ef57b07f8dceef89ab6bdb5839a6 refs/heads/master
D:>git.exe -c core.askpass=true ls-remote -h file:///D:/temp/.git
a4ca18f7b218ef57b07f8dceef89ab6bdb5839a6 refs/heads/master
In your case, you don't want to configure a Git repository to track. Because you are working locally (only), it would be sufficient to configure Custom Workspace to point to your repository (General -> Advanced).
This would be D:\temp, not D:\temp\.git, because the .git directory is merely where Git keeps its information about your repository.

git plugin on windows command fails from Jenkins, succeeds in shell [duplicate]

This question already has answers here:
Unable to get Jenkins and Git to play nice
(2 answers)
Closed 7 years ago.
I'm setting up Jenkins on my windows build machine, with the Git Plugin. I'm using a directory on a network drive Z: as the git repository for now. I enter "z:\my\repo\path" for the Repository URL, and I get:
Failed to connect to repository : Command "git.exe -c core.askpass=true ls-remote -h z:\my\repo\path HEAD" returned status code 128:
stdout:
stderr: fatal: 'z:\my\repo\path' does not appear to be a git repository
fatal: Could not read from remote repository.
Yet if I open a fresh command prompt and type that command, it works without error (and also no output):
> git.exe -c core.askpass=true ls-remote -h z:\my\repo\path HEAD
>
What may possibly be the issue? I am not even sure where to begin. I've set the PATH and GIT_HOME system environment variables and restarted Jenkins, so clearly it is finding the executable.
I've tried the file:///-style path and had the same results.
Output of the manual command with GIT_CURL_VERBOSE=1 and GIT_TRACE=1 set:
15:43:24.905801 git.c:348 trace: built-in: git 'ls-remote' '-h' 'z:\\my\\repo\\path' 'HEAD'
15:43:24.905801 run-command.c:343 trace: run_command: 'git-upload-pack '\''z:\\my\\repo\\path'\'''
I believe the problem could be around correctly setting up the SSH keys.
First suggestion - UNC path for the repo
Can you try using the file://// format for the repo instead of windows path?
If it's a share try using git clone file:////<host>/<share>/<path> instead.
Please use this as reference.
Second suggestion - SSH Keys
From https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin- :
(though the error is different that what you have)
Some windows fun
If you did everything, you should now have a ~/.ssh folder
(c:\Users\Bob.ssh for instance) and this folder contains your keys.
At that point, you may even be able to manually (from the console),
clone your repository but Jenkins keeps failing with something like
this:
code 128: Cloning into C:\Program Files\Jenkins\jobs\PG3\workspace...
fatal:
The remote end hung up unexpectedly
If you run into this issue, you may need to copy the id_rsa* files
from your ~./.ssh to another folder. Find your git.exe and check if
there is an .ssh folder there. If so, copy ~./ssh/id_rsa* to this
folder and try again.

Git fetch github: Index-pack failed

When running the command git fetch github , I get the following error:
fatal: write error: Broken pipe93), 23.23 MiB | 635 KiB/s
fatal: index-pack failed.
I then get a "git.exe has stopped working" error message while Windows attempts to find a solution to the problem.
Running *GIT_TRACE=1 git fetch github* doesn't give any additional details.
Note: I can perform a git fetch github [branch name] directly and that works without error
When I try "Repository > Compress Database" in Git Gui, I get "Error: Command Failed". I get the same error when I try "Repository > Verify Database".
How do I get around this? It's almost like my local repo is corrupt.
System Info
*Git Bash: 1.7.4-preview20110204
Windows 7 64-bit*
Couple of options:
check if the problem persists in a new local repo (so, after re-cloning your GitHub repo)
check if raising the postBuffer size can alleviate the problem
git config --global http.postBuffer 524288000
(as mentioned in "The remote end hung up unexpectedly while git cloning")

Resources