First push to git repository on LAN gives error - windows

I'm new to Git, and setting up a new repository on one of my own windows servers on my local network, with a view to being able to share source code with another developer on my network.
I have installed Git on my local windows PC, and have created a local repository for one of my existing projects.
I have also set up a shared folder on \myserver\Git Repository\
I have done a commit to the local repository, and am now trying to push that to the shared repository on the server.
I am not 100% sure what format I should be using for my URL, but the most promising error I can get is:
Pushing to file://myserver/Git%20Repository/Inhouse/File%20Comparer/.git
fatal: 'C:/Program Files (x86)/Git/Git Repository/Inhouse/File Comparer/.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Why it is looking in program files folder, I have no idea.
I'm trying to keep things simple (to start of at least), and so have been avoiding using any other protocols.
I've tried googling, to find URL examples, but I just can't seem to get past this error about Got looking for the repository in the program files folder.
Any ideas?
Thanks In advance.
Maya

Got it working!
Instead of googling Git+local network share, I specifically added "windows" to my search too, as all the other information I was finding applied mostly to Linux servers.
This link helped the most:
http://elegantcode.com/2011/06/18/git-on-windows-creating-a-network-shared-central-repository/
I still didn't manage to get the //myserver/myshare/myprjectrepo working, so I mapped the share to a drive letter, and used R:/myprojectrepo instead. All working now.

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.

Setting up GitHub - resulted in massive files on local drive

I set up my first gitHub SSH key this morning and am having a few problems.
The first is that there is now a hidden .git file on my computer that is taking up 55.6GB of space.
I followed the instructions here to set up the SSH Key:
https://help.github.com/articles/generating-an-ssh-key/
When I tried to create a new repository I’m getting errors that say “Xcode can’t verify the identity of a repository hosted on “github.com”
At this point I’m extremely confused where I went wrong. Is it possible to delete all SSH Keys and anything local that is taking up space on my machine and start over?
File size screen: https://www.dropbox.com/s/chgyaxewl78zrik/git_file_Size.png?dl=0
Error on upload: https://www.dropbox.com/home/_IOS?preview=Screen+Shot+2016-10-03+at+6.17.29+PM.png
At this point, I would like to delete and SSH keys on my machine and basically start fresh. If anyone has insight on how these massive files were formed please let me know, and if there are any tips on how to make sure this doesn’t happen are greatly appreciated.
Git is a version control system. It allows you to control the changes on your files by making snapshots of how all your files (and then only changed files) look at the moment of the commit. You can read more how this awesome tool works here.
The problem is you have initialized or cloned a git repo on your home folder and git probably made a snapshot of all your files. You can safely rm -rf ~/.git to get rid of the repo.
Edit: Maybe you'll want to erase the code that was in the repo too. Next time you initiate a git repo, do it in a separate/isolated folder.

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.

Transfer local git repo on Mac

I am working on an iOS project. I just created a local repo for my project on Mac. Due to some reasons, I have to transfer it to a windows machine to place it a shared folder. I do not have access to that shared drive from my Mac.
How do I proceed with creating a repo that can be shared? I am at a point where I have all my code committed in local repo. Please advice..
Thanks in advance..
You have a few possibilities:
Just copy the repo to a USB key or external disc, and then transfer to the PC. Git repos can always be transferred, you do not need to do anything special: the on-disk format is always the same. Although you may encounter some issues with file encoding (Windows or UTF-8): it would be good to configure both gits to use UTF-8. Optionally you can zip your repo folder and unzip it on the PC.
Upload to dropbox or similar file transfer service. Same as above.
Share the code on github or a similar public git service. This is by far the best option, although (if the code is not under an open source license) it may cost you money. Upload to github, download from the PC.
Hope this helps.

Resources