How to use artifactory as proxy to get a package? - proxy

I've really tried to understand artifactory and to use artifactory as a proxy to get packages and files from public registries and github but haven't got it to work yet.
Github repository key in artifactory:
github.com
File I want:
https://github.com/nvm-sh/nvm/archive/v0.37.2.tar.gz
I have tried to reach it through a machine with command:
wget https://artifactoryenterprise.corp.com/github.com/nvm-sh/nvm/archive/v0.37.2.tar.gz
But it just timed out.

I'm not sure if it is relevant now, but I assume the issue is with the repo key "github.com" which is causing the DNS resolution difficult. Can you test out by creating a generic remote repository with repo key as "githubcom" and wget the file as below
wget https://artifactoryenterprise.corp.com/artifactory/githubcom/nvm-sh/nvm/archive/v0.37.2.tar.gz

Related

Why does go module ssh custom private repo (non-github) config still request https fetch?

I am using Go modules.
In order to use module version, I cannot use local module. For example:
replace locakpkg => ../localpkg v0.1.0
The above will fail because replacement local path cannot have version so far (go 1.15).
Thus, to make the module version work, I decided to use a private ssh repo.
I did search how to make private ssh repo work for two days.
By following many online articles, I did
git config --global url.user#private.com:.insteadOf https://private.com/
go env -w GOPRIVATE=private.com
I found out go get will always do https fetch to check ssl credential. So I configured a https server properly too.
But in the end, I still get an error message:
unrecognized import path "private.com/foo": reading https://private.com/foo?go-get=1: 404 Not Found
I did google this error and found out this spec https://golang.org/ref/mod#vcs-find which says I have to let the server reply with <meta name="go-import" content="root-path vcs repo-url"> for https fetch request.
If there is a way to use git tag versioning in local module packages, I am OK to use local replace in go.mod instead of configuring a private ssh repo.
If the above point is not possible, how to avoid https fetch when I configure a private ssh repo? I think ssh repo has nothing to do with https protocol.
(I am using go 1.15 at linux. The latest stable version while posting this answer)
I solved the problem and posting here, hopefully, this will help other people one day. I don't find any correct answer by my search online.
In short, the answer is to use .git suffix in all places. Without .git suffix, go mod tidy and go get will use https instead of ssh (git).
At Client:
The file ~/.gitconfig (at linux) if you use /repopath/foo.git path at server:
[url "ssh://user#private.com"]
insteadOf = https://private.com
The file ~/.gitconfig (at linux) if you use ~/repopath/foo.git path at server:
[url "user#private.com:"]
insteadOf = https://private.com/
Execute the following to update ~/.config/go/env at linux:
go env -w GOPRIVATE=private.com
In go.mod, it should use
require private.com/repopath/foo.git v0.1.0
In file.go, it should be
import private.com/repopath/foo.git
At SSH Server
in foo.git/go.mod at private server should have:
module private.com/repopath/foo.git
And make sure the git repo at server has tag version v0.1.0. Don't forget to use git push --tags at client to update the tag version to the server. Without --tags, tag version will not be pushed.
After adding .git suffix to all the required places, go mod tidy and go get will no longer send https request.

How can I solve "We were unable to install a project on your server" in forge laravel?

If I install repository in forge, there exist error like this :
Cloning into 'testshop.co.id'...
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The full error like this :
How can I solve this error?
Double-check your actual ssh URL and see if:
GitLab recognizes you (display a "Welcome" message)
ssh -T git#your.gitlab.server
GitLab has you listed as the owner or member of the project you want to access (for that, you need to go to the GitLab web pages interface)
Are you sure that your repository link is correct? The error is that it cannot find your repository.
It should be something along the lines of UserName/ProjectName .
To ensure what it is go to whatever source control that you use and look in the URL so for my github project:
https://github.com/KyleWardle/RomanNumerals
The link you would put in forge would be
KyleWardle/RomanNumerals
My Forge:

Cloning repositories from github fails

I am unable to clone any repositories from github. I always get this error message
fatal: Could not read from remote repository. Please make sure you have the
correct access rights and the repository exists
I have taken care of the following :
Set my path variable to ;C:\Program Files (x86)\Git\cmd; and C:\Program Files (x86)\Git\bin;
I have generated the public key and linked id_rsa.pub with git
I have seen all the related links and am unable to resolve this issue.
If you have issue with the ssh key, you can at least use as a workaround https url:
git clone https://github.com/username/reponame
Regarding ssh, make sure that:
environment variable HOME is defines, and that your private/public ssh keys are in:
%HOME%\.ssh\id_rsa
%HOME%\.ssh\id_rsa.pub
your public ssh key is added to your GitHub account.

Configure Jenkins to use GIT On Windows, Got stderr: Permission denied (publickey)

My Git version is 1.8.0, for this version, the Git installation path in Jenkins is C:\Git\cmd\git.exe (in older versions, it is C:\Git\cmd\git.cmd). This solves the problem that I had: error deleting workspace. In Jenkins, Git repository URL uses the ssh protocol: git#github.com:xxxxx/xxx.git, for me, this URL works. If your key can't be found, this URL will return an error, you need to define %HOME%, then your key should be in %HOME%.ssh. then I started to build. When I built it, I got:
stdout: Cloning into 'C:\Jenkins\workspace\Lily'...
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)
I don't understand why Jenkins can find my key for the repository URL, but can't find my key when it clones the repository.
Any help will be greatly appreciated.
My company has a proxy server, for me, to use SSH protocol is very difficult, it may have a way to solve the combination of a proxy server and ssh-to-github, but I gave up. In stead, I used https protocol. In order not to prompt credentials for Jenkins, I used github credential cache to solve this. Check here for credential cache: http://www.kernel.org/pub/software/scm/git/docs/git-credential-cache.html. Now my Jenkins/Git build works in Windows.

Github.app: can't connect to remote repository (not on github.com)

I'm trying to host a git repository on my own webspace.
The repository has been set up via terminal+ssh and there were no problems, also I made a local clone of the repository with no problems.
Now I'm trying to use the github app to sync/push to the external repository which is causing big problems. The github app keeps prompting for the ssh password (I think its the ssh password - the box only says 'Password:'), even if I enter the correct one.
The url to the external repository seems to be correct, what have I done wrong (git beginner Oo)
ok, i found my error:
To sync your external non-github repository with your local one, your external repository mustnĀ“t have the branch activated you want to sync.
i switched the external repository to an dummy-branch and then syncing works without problems...

Resources