Git.custom_environment not working for Repo.clone_from in docker - gitpython

I have problem with using Git.custom_environment and Repo.clone_from methods.
Running in a non-docker environment is successful and it fails to run under docker environment
gitpython version 3.1.9
python version 3.6.4
git version 2.24.3
mycode
Repo.clone_from(sourcecode, localpath, branch=branch, env=dict(GIT_SSH_COMMAND=git_ssh_cmd))
it's my fault or problem is the code?
Thank you.

I'm currently working on something similar to this.
As far as I know, in a docker environment your git settings aren't initialized.
Adding this snippet to the top of my dockerfile helped.
RUN git config --global user.name "user"
RUN git config --global user.email "user#email"
Also make sure that when you clone you specify the ssh option -o "StrictHostKeyChecking=no" if you are using ssh.

Related

Problem with git proxy work only few minutes after reboot of windows

I have some problem with git proxy on my company' laptop.
I added environment variables HTTP_PROXY, HTTPS_PROXY and a FTP_PROXY in system variables.
After reboot my git works fine for some minutes everything is fine - push work and I can pull everything.
But after few minutes of laptop working I face error:
Push failed unable to access 'https://gitlab.****.com/**/**/': Proxy CONNECT aborted
I do not know what to do I have already tried to unset git config variables as http.proxy, https.proxy but it does change nothing.
When I face this error I perform computer reboot and I am able to push or pull and the error message does not appear[ but only for just a few minutes !].
System: Windows
VPN: turned ON
Git reinstall does not help.
The error occurs in cmd and in PyCharm.
Git user.name and user.email are correct.
I also tried to use http.proxy and https.proxy as http://login:pwd#server:port and it does change nothing.
Please help me, thanks and best regards.
Solution:
reinstall git
set credential.helper to manager-core in ../Git/etc/gitconfig
set environment variables to small letters ftp_proxy, http_proxy, https_proxy and use the same 'http://' prefix for each of them
remove all windows credentials with git: preffix,
remove http.proxy from git config --global -l, --system and --local
add windows credential ( generic) for https://gitlab.domain.com
If did not work reinstall windows and try once again.

Git clone on windows : git#github.com is not a git command

I'm trying to clone a repository the ssh way from github and another form gitlab
I'm on windows EDIT : with Git v 2.29.2.2
I'm getting the following error, which I do not understand from what it is coming from :
$ git clone git#github.com:math-gallou/AI21_TPs.git
Cloning into 'AI21_TPs'...
git: 'git#github.com' is not a git command. See 'git --help'.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
So I also tried :
$ git clone "ssh://git#github.com:math-gallou/AI21_TPs.git"
and
$ git clone ssh://git#github.com:math-gallou/AI21_TPs.git
But the same exact error comes out.
When I do the ssh -v git#github.com I can connect with success.
So what did I miss ?
First, if you are trying the ssh:// syntax, then the URL would be:
git clone ssh://git#github.com/math-gallou/AI21_TPs.git
^^^ /, not :
Second, check if you have a %USERPROFILE%\.ssh\config file with a github.com Host entry in it, whose content might be incorrect or mis-interpreted.
In my case, I defined system environment variable GIT_SSH to use openssh I installed, and then git is broken and I got git: 'git#github.com' is not a git command. See 'git --help'..
After deleting system environment variable GIT_SSH everything works again.
Then I tried to define user environment variable GIT_SSH and restart system (I didn't restart system in previous try), somehow now my git works correctly with openssh I installed. I don't know which part is wrong in my previous try but I decide not to waste more time on this.

error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

I am having and old Macbook running Osx Lion 10.7.5 which is the highest upgrade that it supports.
On running git clone I get this error.
Veers-Macbook:~ Veer$ git clone https://github.com/heroku/python-getting-started.git
Cloning into 'python-getting-started'...
fatal: unable to access 'https://github.com/heroku/python-getting-started.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Based on other similar questions, my system details are as follows:
Veers-Macbook:~ Veer$ which git
/usr/local/git/bin/git
Veers-Macbook:~ Veer$ git --version
git version 2.3.5
Veers-Macbook:~ Veer$ git config http.sslVersion
tlsv1.2
I ran these two commands
git config --global --unset http.sslVersion
git config --global --add http.sslVersion tlsv1.2
To verify I ran the config file
Veers-Macbook:~ Veer$ git config --global --list
user.name=Gurupratap Matharu
user.email=gurupratap.matharu#gmail.com
credential.helper=osxkeychain
core.excludesfile=/Users/admin/.gitignore
mergetool.sublime.cmd=subl -w $MERGED
mergetool.sublime.trustexitcode=false
merge.tool=sublime
alias.gui=!sh -c '/usr/local/git/libexec/git-core/git-gui'
http.sslversion=tlsv1.2
Looks like the config file has the http tlsv1.2 but the error still persists.
could you guide how can I fix this. My only aim is to use github via the command line.
This is likely caused by old encryption on lion, which the internet has declared as deprecated ( for example, https://githubengineering.com/crypto-removal-notice/ )
For one solution, you can try tigerbrew https://github.com/mistydemeo/tigerbrew
For a different experimental solution, I have made my own very simple package here: http://try.gitea.io/donbright/lm which will bootstrap curl and git on a Lion machine if you have Xcode + Xcode command line tools already installed. However your complicated git config will maybe not work with it, you might have to wipe the config clean.

Git "add --patch" is not working

When I type git add --patch on my Windows 10 machine in the terminal, I get the error:
git: 'add--interactive' is not a git command. See 'git --help'.
I've googled to no avail, all other problems seem to be people running into this issue using other software or on Linux. Any tips?
This thread (for Git on Linux) mentioned the lack of a git-perl package.
But that should not be the case on Windows.
For testing, download PortableGit-2.17.0-64-bit.7z.exe and uncompress its content anywhere you want.
Then setup a simplified PATH:
set G=c:\path\to\latest\git
set PATH=%G%\bin;%G%\usr\bin;%G%\mingw64\bin
set PATH=%PATH%;C:\windows\system32;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\
In that CMD session, try again your git add -p command.

Enterprise proxy blocking yarn, npm and git

So I have been having some issues with git, npm and brew. It seems to be related to the enterprise proxy I used before. I am not using this computer anymore behind that enterprise proxy but it seems I haven't cleared all the proxy settings. I have cleared all the instances I can find in "Network settings" but there seems to be more. Anyone got a good idea for how to find where my proxy is kicking in and how to remove it? An example of how it looks in the Terminal
brew install yarn
==> Downloading https://homebrew.bintray.com/bottles/node-7.7.2.el_capitan.bottle.tar.gz
curl: (7) Failed to connect to proxy.enterprise.com port 123: Operation timed out
To delete git proxy settings, try doing:
git config --global --unset core.gitproxy
git config --global --unset http.proxy
You can also see all proxies defined by doing:
git config --global -l
And then you'll know which ones to delete.
npm has it's own proxy settings which you can delete:
npm config delete proxy
npm config delete https-proxy
For brew, make sure http_proxy isn't set in your envirionment variables.
That is, something that looks like this:
http_proxy=http://<proxyhost>:<proxyport> brew install $FORMULA
or
ALL_PROXY

Resources