Gitolite on Windows - cloning stuck - windows

I have installed gitolite on windows server using cygwin, installation steps went without problems and when I try to "ssh gitadmin#gitserver info" from local machine(windows) I get the correct response:
hello gitoliteAdmin, this is gitadmin#VRGWLSDEV1T running gitolite3 v3.6.1-6-gdc
8b590 on git 1.9.4.msysgit.0
R W gitolite-admin
R W testing
If I try to clone using Git Bash I get error:
$ git clone gitadmin#gitserver:gitolite-admin
Cloning into 'gitolite-admin'...
git: 'shell' is not a git command. See 'git --help'.
Did you mean this?
help
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If I try to clone using cygwin terminal on local mashine (using the same ssh key and I get the same valid gitolite message) it returns:
$ git clone gitadmin#gitserver:gitolite-admin.git
Cloning into 'gitolite-admin'...
...and stays like that for enternity!
I have searched for multiple solutions, added PATH (with Git etc.) to .bashrc and .bash_profile files on gitolite designated server. Also added PATH to .gitolite.rc to include custom Git installation path (before that I did not recieve the gitolite message)
If you have any solution or idea what did I do wrong: please....HELP.

Resolved it by myself:
Mysis Git installation was confusing Cygwin. Added Git pack to Cygwin and removed Msys Git env. variables: everything woks perfectly now.

Related

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.

How to git clone in wsl?

I try to clone a repo from a brand new Windows Install with wsl (Ubuntu 20.04).
What I did : generate SSH key and add public key to both github and framagit.
Tried
ssh -i -T git#github.com
And
ssh -i -T git#framagit.org
Both of them saied "Hello my pseudo, you're authentified"
But when I try to clone I have the following :
Without sudo :
Cloning into 'testaaa'...
error: chmod on /mnt/d/dev/dev/testaaa/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'
With sudo :
Cloning into 'testaaa'...
ssh: connect to host framagit.org port 22: Network is unreachable
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What can I do to solve my issue?
You can fix this by following this guide. Summary below.
From a WSL prompt:
sudo vim /etc/wsl.conf
Add these lines:
[automount]
options = "metadata"
Save the file, shutdown wsl from a PowerShell prompt:
wsl --shutdown
Re-open a wsl terminal. You should see files owned by your user now instead of root. You can now git clone, chmod, chown etc.
You don't want to use sudo here, and in general there's no reason to need it with Git unless the repository you're working with is owned specifically by root.
The problem you're seeing is that you're using a Linux Git, which expects standard Unix permissions to work, on a file system (NTFS) that does not support them. Git will try to set the permissions appropriately when it rewrites the lock file which it will rename into places as the config file, but it can't do so, and it fails. Git for Windows doesn't have this problem because it maps these permissions differently from WSL, which just always returns an error.
You can try a couple of things:
Just clone the repository under WSL and not under a Windows drive. This is guaranteed to work, and should be fine.
Clone the repository somewhere under WSL and move it into a Windows drive, either setting the config options manually for Windows or trying git init again in the repository after cloning.
Run git init on the Windows drive and then do a git remote add origin YOUR-REMOTE and a git pull origin master (or whatever your branch is called).
It's possible that the last one may not work any better than what you have now, since git init may fail the same way.

Does SSH server need to be running in a unix style environment on remote client for GIT clone to work?

I am tasked to set up a central GIT repo internally for my team.
I'm working on getting this setup on a Windows Server 2012 R2 machine. To the best of my knowledge I've set this up correctly.
I have been following this tutorial but they use CopSSH which isn't free anymore so instead I installed Windows OpenSSH here: Install-Win32-OpenSSH.
On our windows server I've installed and configured the Windows OpenSSH along with GIT. Made the appropriate changes with regards to the environment variables and references needed.
On my local system (also windows) I've installed Putty and generated my public and private keys. The public key has been copied to the server and placed in the correct file. Using putty, I have verified my public/private key authentication is working.
On the server I created a git bare repository in the C: drive like so:
cd C:\
mkdir testing.git
git init --bare testing.git
I installed GIT on my local machine and run the command:
git clone ssh://name#host:port/testing.git
I always end up with the output:
Cloning into 'testing'...
fatal: ''/testing.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've tried different variations of this command with the same results and moving the testing.git file to the user home directory (C:\Users\name):
git clone ssh://name#host:port/c/testing.git
git clone ssh://name#host:port/~/testing.git
I've messed with permissions to explicitly give permissions for this user to access that directory.
It seems as though, maybe the git clone command cannot find the folder on the remote server. I started thinking that the SSH server itself needed to be running in a unix like environment like cygwin. Is this my issue? I've seen tutorials/walkthroughs of installing cygwin with openssh and this would be my next attempt.
Thanks for any help!
EDIT:
So I went ahead and installed Bitvise with their 30 day trial (to try) and everything works but this is only for 30 days. So this must mean that there is some set up issue with the Windows OpenSSH that I have?

msysgit cannot pull tags

When doing a git pull on a project with GIT tags, I get the error below.
I use msysgit on Win8, versions:
git-gui version 0.19.GITGUI
git version 1.9.5.msysgit.1
Tcl/Tk version 8.5.13
The error I get is:
$ git pull --tags
Enter passphrase for key '/c/Users/Me/.ssh/id_rsa':
fatal: Unable to create 'c:/Users/Me/someproject/.git/refs/remotes/origin/lpt1.2-support.lock': No such file or directory
fatal: The remote end hung up unexpectedly
Any clues?
I think the ssh couldn't find your keys. Make sure they are in the default location.
Try to clone the remote. If you are not able to clone and you get the message "The remote end hung up unexpectedly". We can suspect that the your ssh key is not in the default location.
If you are able to clone, and couldn't pull check if you have any locks and the directory exist on your local. c:/Users/Me/someproject/.git/refs/remotes/origin/lpt1.2-support.lock
On msysgit, check if the variable HOME is set. HOME can be set to any directory you want, you only have to make sure you have the right to write in it (and that the directory exists and a .ssh under it exists too).
ssh-keygen -t rsa
And follow the prompts there.
If the problem is solved could you please let me know which of the three cases above helped you.

git on Windows: fatal: protocol error: bad line character: #-

I was using SourceTree + Git on Windows without any problem. I was able to use git commands from command (terminal/BASH). I prefer to use terminal for git push/pull etc. Unfortunately, after reinstallation of my machine (server/git are the same), I'm getting this painful error.
On a new machine, I installed Git 1.9.5 (Git-1.9.5-preview20141217.exe) and configured to use BASH only and plink with proper SSH key file.
I can do git log on my repository, but git pull or git push gives this error:
me#NEW-MACHINE /c/Workspace/project (master)
$ git pull
fatal: protocol error: bad line length character:
#-
ERROR: Problem parsing the command line arguments.
Of course, I searched many articles related to "fatal: protocol error: bad line length character". But, couldn't find any clue.
Interestingly, on SourceTree, I can do git pull or push successfully. I'm only getting this error in BASH terminal. Note that SourceTree doesn't use embedded git.
Here are my investigations so far:
I installed an older version of git (1.8.x), still getting error.
Moved .bashrc, but no good.
Obviously, not a problem of SourceTree as SourceTree doesn't use embedded Git.
The server is in Github (enterprise, private).
I have no problem using any git commands on my Linux with the same git repository/server.
My clue is <newline>#-<newline> from the error message. It is more like a problem of Windows/BASH-specific problem. I can't figure it out what causes "#-".
Edit: I tried suggestions in this thread, but didn't solve my problem. The git server is github.mycompany.com, which doesn't allow any ssh connection.
You can circumvent the bash-ssh issue entirely by:
launching a DOS shell with git-cmd.bat (packaged within your Git for Windows msysgit distribution)
using git clone to make a new clone using the proper https url of your remote repo.
That is:
git clone https://<yourAccount>#github.mycompany.com/<yourAccount>/<yourRepo>
Since you will be using in this case the https protocol, there won't be any shell session during a git pull (as opposed to the ssh protocol: see The Smart Protocols), and you shouldn't see any extra message like fatal: protocol error: bad line length character.
I had same issue for git in windows.
Load your public/private key by Pageant App (Putty Authentication Agent).
add private/public key.

Resources