git-svn ignores http proxy (debian) - linux

Searching how to use git with a proxy I found two solutions:
the http_proxy environment variable
the git config http.proxy
Since export http_proxy=http://proxy.fqdn:8080 made wget work, but not git-svn, I tried the second option additionally: git config --global http.proxy http://proxy.fqdn:8080. But to no success. Wireshark still tells me that git-svn contacts the remote repository directly. Alas:
git svn clone -s http://svn.wp-plugins.org/yak-for-wordpress
ZM-Schicht Anforderung gescheitert: OPTIONS von »http://svn.wp-plugins.org/yak-for-wordpress«: Konnte keine Verbindung zum Server herstellen (http://svn.wp-plugins.org) at /usr/lib/git-core/git-svn line 1916
Am I missing something, or is this a bug in git-svn? Did anyone try successfuly to clone a svn repo through a proxy?

Make sure you don't have to specify your username and password as well (in addition to the proxy address).
But also consider adding that same information (http.proxy) to SVN itself (as in this thread):
Adding proxy information in the [global] section in $HOME/.subversion/servers fixed the issue.

Related

Can't interact with github

My laptop runs arch linux. I wanted to use github to backup my project. In the beginning everything worked fine, I was able to push the first two commits.
Then I wanted to push the third commit but it took forever. From then on every communication (push, pull, clone etc. on multiple repositories) with the remote repository took forever and ended with the error: fatal: could not read from remote repository. There was one exception where i was able to push. Afterwards it was the same again.
The ssh authentication is working. ssh git#github.com delivers the expected response. (ssh -T git#github.com takes forever and is not successful - is this relevant?)
There are a few similar threads but I haven't found a working answer.
What i have already tried:
Checked remote repository (git remote -v): -- is correct
Started ssh-agent and added key (eval `ssh-agent`, ssh-add)
Forcing ssh to use IPv4 (in ~/.ssh/config: AddressFamily inet)
Removed git enviroment variable (unset GIT_SSH)
Tried multiple keys (rsa, ed25519) with/without password
Used the url wiht ssh:// scheme (ssh://git#yourhost:port/path/repo.git)
Updated git
Complete update of the os
Credential helper disabled (git config --global --unset credential.helper)
Checked credentials (git config --global user.name , git config --global user.email)
I even tried to trace the git pull:
GIT_TRACE=2 GIT_TRACE_PACK_ACCESS=2 GIT_TRACE_PACKET=2 GIT_TRACE_PERFORMANCE=2 GIT_TRACE_SETUP=2 git push -u origin main --verbose
With the result:
14:10:30.980851 trace.c:312 setup: git_common_dir: .git
14:10:30.980857 trace.c:313 setup: worktree: /home/alex/Entwicklung/NetCore/ActivityTrackerPC
14:10:30.980863 trace.c:314 setup: cwd: /home/alex/Entwicklung/NetCore/ActivityTrackerPC
14:10:30.980868 trace.c:315 setup: prefix: (null)
14:10:30.980872 git.c:460 trace: built-in: git push -u origin main --verbose
Push nach github.com:2kHammer/ActivityTracker.git
14:10:30.984208 run-command.c:655 trace: run_command: unset GIT_PREFIX; ssh git#github.com 'git-receive-pack '\''2kHammer/ActivityTracker.git'\'''
Then it hangs until the error occures.
For now i copied the project to my raspberry und pushed from there. There it worked without problems.
I am really desperate, git is an essential tool.
Try to re add your ssh key to your ssh agent
ssh-add ~/.ssh/id
where id is the ssh key is the key associated with your github repository

git clone from internal gitlab repository doesn't work unless I'm running as root

I'm trying to clone an internal gitlab repository, but it keeps giving me this error message
fatal: unable to access 'https://gitlab**************.git/': gnutls_handshake() failed: Error in the pull function.
But somehow, if I'm running as root, the cloning process would run perfectly.
The problem is, I needed this to work because I'm trying to use this repository on Jenkins.
Can someone help me or explain why it only worked if I'm running as root?
root uses the same version of git and curl.
But it does not use the same:
global git config: compare the output of git config --global -l in both instances (root and regular user account).
environment configuration (type env in both cases, and compare the environment variables)
In particular, look for sslcainfo (git config --global -l|grep -i ssl) which could reference the certificate needed to contact through TLS your on-premise HTTPS GitLab URL.

Log4j-Audit Getting Started fails for Catalog Editor

Was doing the Log4J-Audit getting started at https://logging.apache.org/log4j-audit/latest/gettingStarted.html
In the Catalog Editor section found some problems:
Download jar url was incorrect, missing "log4j-audit" folder
wget url was incorrect, had an extra 1.0.1 folder
git remote -v was set to ${remoteRepoUrl} instead of actual http://github.com/etc address. And the repo was not pulled. The .git folder was found but the git pull never happened. I think this might be related to proxy server but not sure if git supports a Variable.
Am I doing it wrong or are the instructions incorrect?
Where can I report such a problem?
In the end, I manually changed the
git remote set-url origin http://github.com/etc
did a manual git pull, and then the UI finally came up.
So, #1 and #2 are still a problem.
Because I have a corporate proxy server which also requires a user/password
3 was solved with adding system env vars like this
java -Dhttps.proxyHost=myProxyServer -Dhttps.proxyPort=8080 -jar log4j-catalog-editor-1.0.1.jar
It does seem that the sun.net.HTTPSClient class which is called, does not mention using Basic Auth so not convinced why it works.
A new thing I found in the Getting Started tutorial is that it's important to change the branch=master in the application.properties.

Cannot push to my github private repository

As I'm learning git, I have set up a private repository on GitHub. I have created ssh key and store it to my GitHub account and edited .ssh/config file on my local Linux machine:
## github
Host github.com
User git
HostName github.com
IdentityFile ~/.ssh/github.key
I can successfully connect to my GitHub account:
$ ssh -T github
Hi <UserName>! You've successfully authenticated, but GitHub does not provide shell access.
I have initialized a git repository on my local machine, set up user and added a remote repository:
$ git init
$ git config user.name "UserName"
$ git config user.email "UserEmail"
$ git remote add origin ssh://github:<UserName?/<repositoryName>.git
I have created a README.md file, added it to git and commited it:
$ git add README.md
$ git commit -m "First commit."
Now everytime I try to push, I get this error:
$ git push origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Cloning the repository works, however that is the only thing I can do.
Why can't I push to my private repository? What am I doing wrong?
Try instead the scp syntax, to make sure your ~/.ssh/config file is used:
git remote set-url origin github:<username>/<repo>
Then try and push again.
Git itself uses an OpenSSH version (at least the one packages with Git for Windows)
> ssh -V
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
As explained in "Why doesn't the ssh command follow RFC on URI?", there is a difference between:
ssh://[user#]host.xz[:port]/path/to/repo.git
vs.
user#host.xz:/path/to/repo.git
Only the latter syntax user#host.xz: uses the ssh config file.
When SSH was originally developed, it was developed as a more secure, drop-in replacement for the earlier RSH/rlogin suite of tools.
See "History of the SSH protocol".
OpenSSH (1999) predates URI (finalized in RFC 3986, published in January 2005)
If the host portion was allowed to be on the form host:port, this would create a potential ambiguity: does jdoe#host.example.com:2222 refer to ~jdoe/2222 on host.example.com when connecting on the standard port, or does it refer to no file at all (or worse, ~jdoe) on host.example.com when connecting over port 2222?

Accessing Github behind corporate proxy Node.js

I am having an issue with calling the following command from cmd for installing PhoneGap:
npm install -g phonegap
The following error is returned:
Failed to connect to github.com port 443: Timed out
There are a fair amount of questions regarding this topic and they all seem to provide the same answer - make sure the proxy settings for git and nodejs are configured. I set up the node proxy settings like so:
npm config set proxy http://proxyname:8080
npm config set https-proxy http://proxyname:8080
And for git:
git config --global http.proxy http://proxyname:8080
git config --global https.proxy http://proxyname:8080
Both git config --list and npm config list confirm that these proxy settings are in place.
I have also allowed the programs through the fire wall by going to Windows Firewall -> Allow a program or feature through windows firewall. Then I selected the node.exe for Node.js and for git I selected git.exe.
I still however have the issue whereby it is failing to connect to Github. Is there anything else I am missing or forgetting to setup? Both Node.js and Git were installed for the first time for this task.
In addition to the above settings, it's possible that you're getting this error if some of the downloaded libraries declare their dependencies using the git:// protocol instead of https://. These dependencies then usually fail with the above error.
To fix this, you can run the following:
git config --global url."https://".insteadOf git://
This will add a configuration option to Git, asking Git to use https whenever a URL uses the git:// protocol.
This setting fixed many proxy issues for me.
You need to add proxy authentication to your command application. I assume you are working in windows, the following works for me (I don't need to add the proxy to either npm or git unless running git commands).
In your active command window you need either or both of these for each session including initial instalation adding devices or plugins and on first application build:
set https_proxy=http://username:password#proxy:port
set http_proxy=http://username:password#proxy:port
So mine looks like this:
set https_proxy=http://john.doe:1234#proxy.det.nsw.edu.au:8080
Ben
With git 2.8 (March 2016), you don't have to embed in clear text your password in the url.
See commit 372370f, commit ef97639 (26 Jan 2016) by Knut Franke (``).
Helped-by: Junio C Hamano (gitster), Eric Sunshine (sunshinebell28), and Elia Pinto (devzero2000).
(Merged by Junio C Hamano -- gitster -- in commit 30f302f, 03 Feb 2016)
http: use credential API to handle proxy authentication
Currently, the only way to pass proxy credentials to curl is by including them in the proxy URL. Usually, this means they will end up on disk unencrypted, one way or another (by inclusion in ~/.gitconfig, shell profile or history).
Since proxy authentication often uses a domain user, credentials can be security sensitive; therefore, a safer way of passing credentials is desirable.
If the configured proxy contains a username but not a password, query the
credential API for one. Also, make sure we approve/reject proxy credentials
properly.
So:
In addition to the syntax understood by curl, it is possible to specify a proxy string with a user name but no password, in which case git will attempt to acquire one in the same way it does for other credentials.
See gitcredentials for more information.
The syntax thus is:
[protocol://][user[:password]#]proxyhost[:port]
This can be overridden on a per-remote basis; see remote.<name>.proxy.
http: allow selection of proxy authentication method
CURLAUTH_ANY does not work with proxies which answer unauthenticated requests with a 307 redirect to an error page instead of a 407 listing supported authentication methods.
Therefore, allow the authentication method to be set using the environment variable GIT_HTTP_PROXY_AUTHMETHOD or configuration variables http.proxyAuthmethod and remote.<name>.proxyAuthmethod (in analogy
to http.proxy and remote.<name>.proxy).
The following values are supported:
anyauth (default)
basic
digest
negotiate
ntlm

Resources