Missing/corrupt object file errors when using Git repository in Windows 8.1 Skydrive - windows

I like to keep my local Git repos in my Skydrive folder so they sync nicely between machines and I always have an online copy. However, I've recently run into problems after upgrading from Windows 8 to Windows 8.1.
Specifically, I started getting errors that [hash] object was missing or corrupt. After debugging the issue, it turned out that Git was having difficulty with 8.1's new Skydrive integration into the file system. Specifically, 8.1 likes to list files as if they're stored locally, but keep them online until they're accessed. It turned out that right clicking my repo folder and clicking 'make available offline' solved the git errors.
Is there some convenient git or windows setting that I can change to make this unnecessary? It's not a big deal to make files available offline (in fact, I'll probably do that anyway), but I'd like to know if there's a neater solution.

You don't keep a git repo in a synchronized folder (Dropbox, SkyDrive, ...): too many files, too many corruption possibilities.
What you keep is a bundle:
one file
which can be incrementally updated,
and which represents your git repo
and from which you can clone a local repo
See:
"Git with Dropbox"
"Using Dropbox to synchronize files and having them backed up in version control"
"Git with Dropbox Issues"
Or, you can push those repos to a private repo hosting service like BitBucket, as commented by ta.speot.is.

Related

Create remote git repository on Windows machine from Pi

I have a project I built on a raspberry pi, including a git repository. I'd like to make it that when I type git push, it would push to my windows machine (I've had an SD card fail on me in the past, and it cost me lots of code, so I'd like an external backup). I've tried many tutorials, all of which fail due to some reason or other. My latest, is I'm trying to follow this one
I have a windows 10 machine. I went to Control Panel, System and Security, System, and copied the computer name from Computer Name (DESKTOP-UFCQ4N8).
I created a folder called f:\Shared\Git\thermostat. In windows explorer, I right-clicked on here, selected Properties, Sharing tab, and then clicked Share. I added Everyone to users, and clicked share
I then did:
f:\Shared\Git\thermostat>pushd \\DESKTOP-UFCQ4N8\thermostat
Z:\>mkdir MyGitRepo1
Z:\>cd MyGitRepo1
Z:\MyGitRepo1>git init --bare
Initialized empty Git repository in Z:/MyGitRepo1/
Z:\MyGitRepo1>popd
I finally try the following:
pi#raspberrypi:~/devel/thermostat $ git remote add origin file://DESKTOP-UFCQ4N8/thermostat/MyGitRepo1/
pi#raspberrypi:~/devel/thermostat $ git push origin master
fatal: '/thermostat/MyGitRepo1/' 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.
pi#raspberrypi:~/devel/thermostat $
But it does not seem to recognize the repo. I've spent quite a bit of time playing with different permutations of this, but can't seem to figure out what I'm missing. Does anyone know what I'm doing wrong?

How do I stop OneDrive from downloading git.exe on Windows?

I have used Git on Windows for a while, but recently changed the setting and got this.
On almost every command for Git Bash (also on PowerShell and Github Desktop) I get
git.exe is being downloaded on OneDrive
(translation may not be exactly the same)
The setting that changed recently is moving my repos to a OneDrive folder in order to have them synced between two sessions: that is work desktop and remote virtual machine.
I can see that this may not be ideal, but it really works for me since I have the same settings on both sessions, and not really get used to doing many commit-push-pull. Not the main topic here, but feel free to comment.
(Edit): Upon reading solution, there are other ways to set this syncing that doesn't mess up with the internals of Git. Look for that instead. Thanks.
In any case, the strange thing is that the notifications happen only on the Remote Virtual Machine, but not on the desktop.
I have seen some notifications about some files in the repos, which I then attribute to OneDrive being nosy about every move I make file I move. But then I've also seen files I don't know about, and theres always git.exe attached to the notification.
In the first scenario I have tried tuning down the notifications for OneDrive. Some might say Microsoft does have a background for not letting users setup their notifications, so I'm still looking.
Thanks.
Most file syncing tools like OneDrive and Dropbox operate by syncing data file by file. This is a great approach if you're working on a single word-processing document or spreadsheet. However, it's not as great when you're working with a Git repository.
When changing between branches or making a commit, Git changes and creates a lot of files all at once. In order to be synced correctly, all of the created files must be written in a similar order: all the blobs must be written, then the trees, then the commits, and then the refs can be updated. If you do this out of order, your repository can be corrupted, since you can have branches that refer to objects that don't exist (or objects that refer to other objects that don't exist).
In addition, these tools can end up deleting files you wanted to have in your working tree or recreating files you didn't. So overall, you don't want to sync any Git repository using one of these tools.
You can write a bundle file with git bundle and sync that, or you can use rsync to sync a repository provided it's idle (not being modified) when you do. Note that if you sync a working tree, Git will need to refresh all files when you sync it across to the new machine, and also Git doesn't try to defend against untrusted users who have access to the working tree.
It's also not a good idea to sync your Git installation itself via OneDrive, which is what it sounds like might be happening. Instead, install Git for Windows on each machine independently and don't try to sync it across. OneDrive should have configuration options that let you control what's synced.

Upgraded to rails 5.2, and now when I push to heroku, why is it being prevented because of git-LFS (which I'd never heard of before today)?

"This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push."
I've never heard of git-LFS, much less installed it, before. This repository was pushing to heroku just fine for 2+ years.
I recently made a new fork so I could try upgrading to rails 5.2 and ruby 2.4. I got it all sorted and pulled my master FROM that fork, so my master is now rails 5.2 and ruby 2.4.
But I can't push it to heroku because of the above error.
I have no idea where git-LFS came from. I never installed it, and now I don't know how to get rid of it.
If anyone knows why I can't push to heroku, or how to disable this git-LFS (that feels like malware), please let me know! I've been searching for hours :(
Git LFS is an extension to Git that provides better handling of large files than native Git. When you use it in a repository, it installs hooks to ensure that the LFS files are pushed when you push your repository.
You should check your repository for a .gitattributes file. If there is one, and it contains entries that say filter=lfs, then your repository is using it to store large files. If not, then you can fix this by removing the hook in .git/hooks/pre-push, as the message says.
You haven't specified what operating system you're using or where you get your software from, so I can't tell you how it likely got installed, but it is currently removed from your system, which is why you see the message. It may have been installed through your system package manager, such as dpkg or Homebrew. If you're running on Windows, it's shipped as a standard part of Git for Windows.
I'm on a Mac. It really was as simple as deleting that file. It didn't occur to me at first that it was literally just a file in a folder on my hard drive because files and folders don't start with a period. And everything I'd read said to delete it from my repository; I read that and I'm thinking it's on github somewhere, not my local drive. Then I looked in my app's folder and saw a .git folder at the top, and from there it was obvious.

How to create a git repository on a shared windows machine which all developers can push to

I have created a bare Git repository on a shared windows machine on a local area network. I am experiencing a problem in which nobody else but me is able perform a push operation. When trying to sync with or push to the remote repository using the Visual Studio 2013 Git tools, other users receive an error reading "Opening repository: .The following errors were reported during push: refs/heads/master, Failed to rename lockfile to '/refs/heads/master': Access is denied." There seem to be a lot of similar questions about creating a shared repository on stack overflow though none of them have given me the right solution for my problem. One thought is that I may need to create a repository user group, perhaps based on our domain user groups, though I do not have any idea how to do this with Git on Windows and have not found any resources for instructions as of yet.
You can share the folder that contains the bare git repository, and just add those Windows users as people who can read and write to those folders. After making a folder "shared" Windows should tell you what the network path should be. Then it's a simple git clone file:////MACHINE_NAME/path/repo.git.

Files lost in Git repo download! Overwrote my work

I think I've done something rather stupid which may have cost me a couple of days of work. What follows is a question not so much about GIT itself as how to recover some files I have lost in the process of trying to use Git on a Mac.
I have been using Atlassian Sourcetree to make Git commits and pushes and to work with other members on a team. I have only been committing, pushing and pulling from Git.
As I've mentioned, I've been using SourceTree, but I wanted to evaluate Github for Mac as well.
At the time, I had made some changes to the files in my Git repo, representing about six hours of work. I did NOT commit or push these changes.
After I installed Github, I stupidly set Github to clone the repo to the same folder on my Mac as I had been making my changes in... essentially, Github downloaded the repo and overwrote all of my changes.
There were some files that were overwritten, and some new files that I created that were deleted.
Is there is a way to retrieve these files, either by some Git-based voodoo or some aspect of Mac OS X journaling that I'm not aware of? I would really appreciate hearing about it if there is.
So, from what I remember from having my life destroyed by my stupidity with git, it has a place where you can find your old code.
Go to your main repo folder and then type cd .git/lost-found/other/ or cd .git/lost-found/
You should be able to find a set of files that were older and you can then manually get them back by copying them in.
Here's some more links on it :
Recovering added file after doing git reset --hard HEAD^
Undo a git pull
http://www.quora.com/Git-revision-control/How-can-I-recover-a-file-I-deleted-in-my-local-repo-from-the-remote-repo-in-Git

Resources