I have a strange behaviour with git on Windows.
Some information
Windows 7
git version 1.9.5-preview20150319
If I try to clone a repository from the git bash with the http protocol like:
git clone http://myhost/myRepository
I get the error
fatal: Authentication failed for http://myhost/myRepository
If I clone the repository with the egit Eclipse plugin I'm able to clone it.
Also If I try the same command on ubuntu (from the same machine, in a virtual machine), I'm able to clone the repository.
Any help to be able to use the bash console in windows? need it for some initial setup.
Thanks in advance
Try to add [credential] section in your gitconfig
[credential]
helper = !\"C:/{msysgit-installation-path}/libexec/git-core/git-credential-wincred.exe\"
[http]
sslverify = false
You can use git config --global -e to edit your git config
For anyone else having this problem, prefacing my username with my htdigest realm ('REALM\USERNAME') fixed it for me. For some reason, it appears that the Linux client and others figure this out for you but the Windows client requires you to specify it explicitly.
Related
So im on Windows 10 and a while ago i decided to use WSL so the I can get zsh. However, now I can no long use git from my wsl terminal, i.e I can no longer git pull from remote repo. When I try I get the following...
'C:\Windows\System32\OpenSSH\ssh.exe': 1: C:\Windows\System32\OpenSSH\ssh.exe: not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Such operations work fine in bash and from GitHub Desktop. Why is WSL trying to use OpenSSH from Windows it should be Linux right?
Im struggling to find information on this problem so any help is greatly appreciated. Let me know if there is more information I can provide.
I got the same error after changing the value "core.sshCommand" like this:
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
In my file ~/.gitconfig, I disabled newlines like below :
#[core]
# sshCommand = 'C:\\Windows\\System32\\OpenSSH\\ssh.exe'
Then when you are in a git repository, if you have the same problem check your my-project/.git/config file and if there is the new config disable it as above.
In my case it worked :-)
Have a nice day
Double check if you have an environment variable GIT_SSH which would point to C:\Windows\System32\OpenSSH\ssh.exe: that would not be a valid path in a WSL session.
Unset it.
After that, it depends on the Windows 10 used ( 1709? 1809? 20H1? ...), and on the WSL used (WSL1 or WSL2?).
I'm on a Windows 10 machine and I have both Git Bash and Ubuntu for Windows Subsystem for Linux (WSL) installed. When I use GitHub's official desktop app to clone a repo via HTTPS everything works fine and I can push my commits via Visual Studio Code with no problems whatsoever. I then try to clone a repo via SSH with Hyper (WSL Bash) and get this:
The authenticity of host 'domain.com (a.b.c.d)' can't be established.
RSA key fingerprint is XX:XX:...:XX.
Are you sure you want to continue connecting (yes/no)?
After answering yes and openning that repo in VS Code and try to push my new changes to GitHub, I get this error:
Git: Host key verification failed.
And this is what I get as Git Log in Output:
Host key verification failed.
fatal: Could not read from remote repository.
I have set up my SSH key on WSL using this method and I didn't set up any passphrase. I tried this on my brother's PC which is exactly set up like mine and it worked just fine. I would appreciate any help!
UPDATE: I typed ssh -T git#github.com in Hyper and got this as an answer: You've successfully authenticated, but GitHub does not provide shell access.
P.S. I'm a newbie in programming and stackoverflow, so please be concise and give me step by step instructions. The more you use technical terms, the more I'll probably get lost!
Try first, for that new push, to do it in command line:
cd c:\path\to\local\repo
git status
git log
git remote -v
git push -u origin master
Make sure that:
git status is clean (no pending changes)
git log shows you at least one commit
git remote -v shows you as origin the URL of your remote GitHub repository
(as an SSH URL git#github.com:<you>/<yourRepo>)
Then push, and go back to VSCode.
Should be faster than the other solution:
In vscode open a new terminal of type "Command Prompt"
Run: git push and accept the new key when prompted.
This will store the remote key for future use.
New to working with git in Windows. I downloaded the GitHub Desktop application and can connect my account, but doing pushes/pulls fails because of an unresolved host. Asking around the workplace I got the following suggestion to type this command into the git shell.
git config --global http.proxy http://username:password#proxy.workplace.com:8080
Does this:
Store my password in plain text?
Send my password in plain text?
Doesn't GitHub for Desktop generate and use SSH keys instead (I got an email notification when I first connected my account)? How can I configure GitHub Desktop to work with this proxy?
To directly add a proxy to Github Desktop without using git shell:
Set up/Sign in to your account in Github Desktop(This won't be a problem, proxy only doesn't allow you to Add, create or clone repo)
Close Github Desktop for the time being(to set up proxy).
Go to C:\Users\#yourusername.
There you will find a file named .gitconfig
Open it with any text editor(I have used sublime text 3) and add
[http]
proxy = http://username:password#your.proxy.address:8080
and save.
Now you can add, create and clone repos in Github Desktop.
Note(for TFS users): TFS will return 502 bad gateway error when you use the above proxy configuration. Use hash # to comment out the proxy config in .gitconfig to switch between Git and TFS.
So actually the solution was to type this command into the git shell.
git config --global http.proxy http://<proxy-ip>:<proxy-port>
Try and upgrade to GitHub Desktop 2.4 (March 2020)
Working behind a proxy
With GitHub Desktop 2.4, we automatically handle setup without needing you to configure anything manually—worry no more!
It might work with this:
git config --global http.proxy proxy_address:proxy_port
git config --global https.proxy proxy_address:proxy_port
If username and password are not that much important then use:
git config --global http.proxy username:password#proxy_address:proxy_port
git config --global https.proxy username:password#proxy_address:proxy_port
I'm just starting to look at Jenkins CI on my Windows 7 machine.
I thought for a first test I would create a git repo on my localhost which is aliased to
http://tests.local/jenkins/local
I setup a job in Jenkins, selected Git under source code management and added http://tests.local/jenkins/local.git as the Repository URL
When the job runs it fails with the error
ERROR: Error cloning remote repo 'origin' : Could not clone http://tests.local/jenkins/local.git
Is this a git issue or a Jenkins issue and how can I fix it?
Thanks
Have you run git update-server-info in your repo? This is needed if you want to clone/fetch via http. Run git help update-server-info or see online documentation here for more details.
I have a windows 2003 box with an ssh server setup. I have msysgit (git version 1.6.2) installed both locally and on the server.
The server has the following absolute path to my repos:
e:\vc\git\myrepo.git
when a user logs in he/she will be put in the following working directory:
e:\vc\git\
When running the following cmd on my dev machine:
git clone ssh://myuser#myip/myrepo.git testrepo
I get the following error:
fatal: ''/myrepo.git'' does not appear to be a git repository
According to my ssh logs it appears that git is executing this cmd on the server:
'cmd.exe /c git-upload-pack '/myrepo.git''
Executing that command locally (on the server) fails for the same reason. I'm thinking the problem is related to git prefixing the path with a '/'. How do I tell git not to do this? Should this be working?
Note: git-upload-pack is working because I added \gitinstallpath\libexec\git-core to the path. Apparently this is a bug and will be fixed in the future, this was my work around.
I resolved this by switching my ssh server from winssh to openssh (via the cygwin layer). I was able to connect fine (as noted above) using winsshd, but winsshd wasn't correctly handling paths prefixed with "/". I could probably get winsshd to work, but switching to cygwin and openssh was faster.
Here's a good blog post to kick start the setup if your in a similar situation:
Have you tried the following?
git clone ssh://myuser#myip/myrepo testrepo
Note the removal of ".git" from the end of the SSH path. You only need that suffix at the end if the remote directory name has it.
Also, have you tried any other SSH URL format? To use a relative path, you can try:
git clone ssh://myuser#myip/~/myrepo testrepo
See the git clone man page for details on other URL formats.
If somebody still interested in workaround:
The problem is - cmd.exe doesn't understand single-quoted parameters. So we use sh instead.
Create file gup.sh with line
git-upload-pack.exe $*
and grp.sh with
git-receive-pack.exe $*
on server!
Then run:
git clone -u 'sh gup.sh' ssh://myuser#myip/e/vc/git/myrepo.git testrepo
git config remote.origin.uploadpack 'sh gup.sh'
git config remote.origin.receivepack 'sh grp.sh'