GIT Client on Windows Complaining about Ownership - windows

With great difficulty due to my limited knowledge of Linux, I set up a GIT server on my Raspberry Pi. It works great except for one thing that's been driving me nuts. I've used every Google fu move I can think of and I've gotten nowhere.
I'm using Git Extensions as the client on 3 Windows machines. One at work (no problems) and 2 at home. The local repository at home is on a shared NAS drive on my LAN. It works fine on my main computer, but when I try to access it on my secondary computer, I get the following error:
warning: '//NAS/REPOSITORY' is owned by:
'S-1-5-...'
but the current user is:
'S-1-5-...'
where 'S-1-5-...' is two different really long alphanumeric strings that mean nothing to me. It says warning, but then whenever I try to do anything I immediately I get errors I can't decipher after that like:
fatal: this operation must be run in a work tree
or
fatal: No names found, cannot describe anything.
I'm the only user, using the same windows account, username, email address, etc. configured in Git Extensions. As I understand it on the server end, the only user is git which I use for all machines.
As a workaround, I'm able to clone the repository to a different folder on my secondary computer and I have no problems with GIT, but I have problems with my code because it expects things to be in a certain directory. I can change that based on the user, but as far as my code knows, I am the same user on both machines (because I am!). So that is not a good solution. I want to be able to work in the same folder on my NAS no matter what computer I'm using.
-Is there a way to configure GIT or GIT Extensions (I'm not totally sure who is doing the complaining) to not care about ownership? I've tried cloning as a Public Repository, but I guess that doesn't mean what it seems to mean because I get the same errors.
-How do I know and/or configure what user GIT or GIT Extensions thinks I am?

Related

TortoiseGit asking for password on password-less login setup

After months of uninterrupted password-less work, my TortoiseGit started to ask me for a password on some of my remotes, when pushing / pulling. I'm seeking a solution to fix this, as this can drive me crazy.
To underline: I want to remain on SSH-based password-less login, so any solutions that assume adding password to URL or permanently storing password in TortoiseGit configuration is not an option for me.
What I found out so far:
My problem is not related to GitHub; I don't use it in TortoiseGit and it happens on other remotes.
I do have SSH, not HTTPS, address as repo's URL and I don't have git clone-like stuff in it.
I can push/pull the same repository using Netbeans (and my Netbeans has Select Configured Git Repository Location option checked, so it uses the same remote configuration).
I can't push/pull remote using Git GUI, reason the same: asking for user password.
This is not related to a particular system or machine (SSH key), as it happens on both my work computer (32-bit Win 7) and home one (64-bit Win 7). Both of course uses different SSH key (see comment to this answer, which claims, that problem is related to 32-bit version of Windows; this is not true, it happens on 64-bit Windows as well).
Repository, this happens on, isn't empty -- I heard and even been personally affected, that sometimes TortoiseGit gets wako and asks for password on password-less login remote, until that remote is empty.
This is not related to a particular remote -- TortoiseGit works fine, without asking for password on some repositories (i.e. BitBucket) but "dies" asking for it on some other (i.e. in local dev network).
To make things even worse, there are certain remotes, on which TortoiseGit on my home computer fails, asking for password, while the very same remote accessed from home computer works just fine. And vice-versa. I set both machines for password-less login using the same steps; only SSH keys differs.
Things I did so far (and didn't solve the problem):
Changing SSH client (TortoiseGit -> Settings -> Network) to both Git\bin\ssh.exe (as suggested in here) and to C:\Program Files\PuTTy\plink.exe.
Using credential helper doesn't helped and I heard that it works for HTTPS only, not for SSL.
Downloading git-credential-wincred.exe and putting it to Git for Windows / msysgit folder didn't help as well; I've already had it there (different version / filesize; checked on both).
This issue is clearly bind to asking for user password, so git did not exit cleanly (exit code 128) error following it doesn't have any other source except missing password and most solutions given here, like crashed git, locked file, missing user e-mail are not solution for me.
OK, that's the farest point I've reached. And still nothing. Can anyone come up with something new, that I should try to solve this issue?
I confirm that "storing password" or _netrc file, or any credential helpers are for https url only, and have nothing to do with SSH.
The usual debugging ssh steps apply, starting by making sure that %HOME% is defined when TortoiseGit is launched, and %HOME%/.ssh exists, and contains the default keys id_rsa and id_rsa.pub.
In a git bash session, you can do a ssh -Tvvv yourRemoteServer to see what the debug error message sequence is, as explained here.
You also can check the result of a GIT_TRACE=2 git push test master, to see if the issue is limited to TortoiseGit and if the verbose output leaves any clue (see here).
Try switching ssh client between putty and openssh to see if TortoiseGit fairs better with one or the other.
The issue appeared yesterday and it took me 2-3 hours of trying all sorts of stuff to fix it. I also contacted server administrator, who claimed not to have done any changes in config in the past days. Hence I put bounty on this question. I also gave it a try today, but still negative. Finally, right now, I made another attempt just to copy the message to my friend, and, all of the sudden, all my repos started to work!
I am absolutely sure I didn't touch configs, it must have been some sort of timeout which took more than 16 hours. I have no idea what the problem was. All I can conclude is that waiting till the next day might help...

XCode, Git and MediaTemple (gs)

I'm wondering if anyone's managed to connect to a self-hosted Git repository on a Mediatemple GridServer (gs) via XCode? I tried setting this up last night, and this is as far as I've got:
Installed Git on my Mac(s)
Created subdomain for git (git.blahblah.com) on my gs service via Terminal SSH
Created empty repository within subdomain (git.blahblah.com/repo/repo.git) via Terminal SSH
Clicked on 'Connect to repo' from XCode's launch menu
Entered repo address (ssh://git.blahblah.com:22/repo/repo.git) in XCode's address bar
Clicked 'clone' once XCode has found the repo and is telling me that "Authentication [is] required"
Chosen the appropriate local folder on my machine to clone the repo to
Tried to enter username and password specified in MT admin panel - the same ones that I used via Terminal SSH to set up the repo in the first place
Get booted with an error message: either 'incorrect username and password' (they're not) or 'specified address does not appear to be a repository, connection unexpectedly terminated by host' (or similar)
Cry. Repeatedly.
Getting to step 6 causes my IP to be blocked by MT, even if I'm logged into the web control panel from the same IP at the same time. Unblocking the IP via the MT control panel has no effect; the IP is blocked as soon as I try and connect via XCode again.
I suspect it's actually step 4 that's causing problems as XCode is trying to 'ping' the repo without credentials as you type in the address (to resolve connectivity).
Has anyone got this working, or do I need to look at hosting my Git repos elsewhere? I'd rather not spend more money on hosting when I have a service that should suit this purpose sitting unused.
After several online sessions with MediaTemple support I've come to the conclusion that it's not going to work.
While I can host a repository on my own gs service just fine, the way that XCode tries to connect to it causes my IP to be blocked every single time. As the blocking is automatic (and can't be turned off) then it seems XCode and MediaTemple have reached an impasse.
It's not a huge issue as I'm the only developer on this project, and I can always use DropBox instead (I was just trying to find a better way of keeping versioned backups across my laptop and desktop). If I really need Git I can use another tool or Terminal.
If I had to point fingers, I'd blame XCode: it seems its support for Git is rather sketchy beyond connecting to an open, gitHub-hosted repository.
Quick update: the solution I've managed to get working is to set up an account on BitBucket, create a project and add it to local Git, commit that to BitBucket and then connect to BitBucket using XCode. I downloaded SourceTree for extra Git activity as per Stefan's suggestion, as I'm still not 100% comfortable using Terminal (I just like GUIs, is that wrong?).
Everything seems to be running smoothly so far; it's just a little annoying that I had to use a third party for Git when I thought my server (which I'm already paying for) could do the job.

Mercurial remotes on the file system instead of http server

I'm currently working on a migration from svn to mercurial. My needs are plain and simple, I need source control over an intranet in our company. I see examples everywhere for setupping remote repos over IIS. I just don't see the point when I can just make a share on a server.
Can I still setup authorizations and authentications on repos using NTFS permissions?
Am I missing something?
Thank you
Putting a repository on a file share works, but it's not the way recommended by the Mercurial team.
See the "shared disk" part of Publishing Repositories on the HG wiki:
generally restricted to intranets, not generally recommended due to general issues with network filesystem reliability
Be sure to check out Chris Becke's answer as well, because he points out another valid disadvantage (people with write access deleting stuff from the network share, be it intentionally or not).
If you are aware of (and can live with) these things, putting the repositories on the network share is without a doubt the easiest way to setup.
My personal experience is that it works perfectly as long as the Windows share is on a "real" Windows machine.
At work we're using a share on a real Windows server without problems, but at home I ran into issues with a NAS (which behaves like a Windows share but actually runs on Linux).
You can read more about my experiences here:
Can you 'push' to network share using Mercurial on 64bit Windows 7?
There are a number of reasons to prefer, well, anything at all to a writable file share.
In essence it comes down to, there is a limited amount of damage someone can do with the ability to do a push via a web-method.
A read/write share on the other hand is necessary to do a push, but also allows a user to delete an entire repo, history and all.
Without even invoking malicious intent, people (or rogue software agents) have been know to navigate to random network shares and accidentally drag a file to someplace it doesn't belong.
The best reason to lock your PC is not because your co-workers find it amusing to use an unlocked email account to send porn to HR, but because its amazing what a cleaning lady can do with a rag and a keyboard. Its also amazing what Music Library applications can find while scanning all shares in a workgroup, and carefully "move" and catalog to someones Library.

How to avoid physical path in bzr+ssh://myserver/C:\mydir?

I am starting with Bazaar (switching from Subversion, sorry if terminology is a bit off sometimes). Using Bazaar locally no problems.
Got bzr+ssh:// working on my Windows server (finally! and even ssh agent is working wow!)
Now I want a shared repository on the server from which the developers can branch to their machines. I want the repository in a specific folder, for example in C:\bzr\MyProject.
When I do:
bzr init-repo --no-trees bzr+ssh://myserver.com/MyProject
it creates the repository in C:\cygwin\home\user\MyProject in the home directory of my user account - it is understandable, but worrying.
Then as an experiment I also tried and succeeded:
bzr init-repo --no-trees bzr+ssh://myserver.com/C:\bzr\MyProject
This created the repository where I wanted. But how do I "map" or "alias" the URL (or bzr) so my developers can logon under their accounts and use URL
bzr+ssh://myserver.com/MyProject
to access the shared repository in C:\bzr\MyProject?
Obviously I don't want developers to use bzr+ssh://myserver.com/C:\bzr\MyProject because of the physical path in the URL.
Ok my own answer is if you want to run Bazaar on a Windows server for a development team who will access it over the internet,
and you are not familiar with Linux, Cygwin, SSHD and related stuff then it might turn out more complicated than you can bear.
I actually abandoned the Bazaar idea and gone with Mercurial. I must say Mercurial install on the server is also steep, but at least it is just Windows, IIS and only a bit of Python. Got it running in half a day.
Some of the problems that I had with bzr+ssh:// on a Windows server are:
Needs SSHD installed on the server. SSHD (from stripped down Cygwin) supplied with Bazaar refused to work. Had to install Cygwin and learn a bit of Linux stuff, how to run as a service, how to configure, how to generate keys.
Hard to add a new user in a way that does not request passwords typing for each command. Will need to generate a keypair, mock with copying the keys to th server in two locations (Cygwin's home user folder and Window's too). Probably need to log on the user to Windows to create a profile. Don't want developers logging on to the server actually.
Hard to set up a shared repository in a specific location on the server. Does not seem possible with bzr+ssh. Possible with sftp. Might need to use symlinks as bialix suggested above.
As a newbie to linux stuff I don't understand all implications of running sshd on the server and giving shell access to the developer accounts. Have to use bzr shell limited... documentation is scarce.
Basically, bzr+ssh:// on a Windows server seems to be what installing Subversion on a Windows server was like several years ago - hard. Hopefully it will get better with Bazaar too because I chose it over Mercurial initially.

How to setup PC and Mac for using git

I use git both for Mac and PC.
When pulling Mac's git from PC, it's easy as I can use ssh.
git clone smcho#prosseek:~/smcho/setup
The problem happens the other way round : to pull from Mac. I guess there are two ways to go.
Method 1 : Connect to server
By using 'connect to server' in Mac, I can make PC's directory like that of Mac. Even though, the file permission issue, it works pretty well.
Method 2 : ssh
I could run cygwin ssh server (cygrunsrv -S sshd) to be accessed from other computers, but for me, I have to wait quite a while to get connection as I explained here. It's almost impossible for to use it with git, as I don't want to wait for minutes to get clone.
Here comes my question.
Is there any better way other than the previous two methods?
Is there a (natural) way to support ssh server from Windows (windows 7 precisely) not using cygwin?
I've started using the philosophy of trying to stick in the native environment that something is designed for.
With that in mind, my windows box has an ubuntu server virtual machine that hosts my git repositories. The nice thing is the linux + virtual box + git is an awesome source repository that is completely free. No extra machine and you can give it very little memory so it isn't a resource hog.
There is even another option:
If you use both computers for developing and just want to keep the repositories in sync, you could create a bare repository and use something like Dropbox to synchronize it.
I see two other solutions :
using a third synchronisation server: GitHub, the most famous (if your program is OpenSource), but you can also find free online private Git repositories
on Windows, you can set up the Git server ('git daemon' command). On MAC, you'll access to the Windows repository using the URL git://ip_of_windows_machine/repository/
You might consider another approach entirely. If you're using git as a revision control system that you might consider a hosted account for mastering your repository, maintaining backups, etc. http://github.com/ is the leader in the space for git.

Resources