Setting up GitHub - resulted in massive files on local drive - xcode

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.

Related

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.

How to restore files git deleted during clone

After working on something for a while, I thought I should put it in a git repo. Using gitlab, I created a new repo and cloned it from the command line onto my Windows 7 machine. This created a folder with a .git folder in it. I then copied all the files I'd been working on into the folder. I then noticed that the command line where I had cloned the repo was asking for a password. I entered the wrong password a couple of times and stupidly hit ctrl+c. Next thing I knew, the folder with all my files was gone. It is not in the recycle bin. Is there any way to restore these files?
Unfortunately, they are lost and git won't help you here. You should rely on file recovery tools to help you recover the files (long, hard and boring process) if you can afford to rewrite your code from scratch.
Buy I could tell you what you did wrong with git and what you should have done to never have been in such a situation...
You should have done :
1. Create a local repository in your project directory with 'git init'.
2. Do as much development and commits as you want (but at least one...). You are now protected against file deletion!
3. Once you think it worth to be shared, like you do, create the repository in gitlab.
4. Add the gitlab repository as a remote in your local repository.
5. Push the history to the gitlab central repository.
Like that, you should have avoided all the risky action you did and your work is secured at all times.
Standard methods for removed file restoration apply:
Suspend any user operations on the HD (don't create/copy/remove files). This will increase your chances when trying to restore.
Check if you have the file copies/originals in other folders. You mentioned that you had copied them previously into git folder. May you have them in the original directory?
Do you have any backup system running (like Crashplan, etc) ? Check if you have a backup of the files
If nothing of the previous helped proceed to the undelete operation - use dedicated utilities like this one for ex.: http://www.ntfsundelete.com

git permission denied on pull/push

I'm trying to create a project using git, but after cloning repository from github in phpstorm i can commint/push/pull only once. After that I see the message about permissions denied on files: COMMIT_EDITMSG or FETCH_HEAD.
I set .git folder visible and not only readable and i can do one commit/push/pull and after permissions denied again. And .git folder become hidden and only readable.
In windows I set full access for .git folder and it files, but got same effect.
Cloning through phpstorm or console have no difference.
ps: Sorry for my english. And some names and title maybe not correct because I have russian windows.
pps: i've scanned my PC and found no viruses.
You can't push to other people's repositories unless they give you permission.
If you want to push the code back to github, fork it first on github, then do a "git clone" with the URL of your own fork, not the original repository.
You should then be able to do pushes to your fork.
Make sure you have configured your public SSH key(s) in the github account settings.
After pushing your changes to your fork, you can do a pull request on github so the original project can merge your changes into their repository.
I had a similar problem. First i tried identified myself in IDEA Jetbrains via userName / password and Test Connection confirmed the correctness of my input. But the comit and the push, etc. only worked with other applications. Not with Jetbrains. but now i used token variant. and that works. :)
https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FWI-41232

First push to git repository on LAN gives error

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.

Xcode 5: The repository could not be reached

I have this issue with Xcode 5 where I'm trying to commit a file to a remote git repository (BitBucket) and getting a pop up window with the following error: "The repository "project_name" could not be reached. Please verify that the repository is online and reachable and try again."
I've been working with this setup for awhile now (since Xcode 4) and didn't have any problems with it. Under Xcode->Preferences->Accounts->Repositories I saw the correct repository, but duplicated. I deleted and added it again, but it didn't help. I tried closing the project and rebooting the computer and it didn't help either. I can see the project's history under Source Control->History. I can access the repository on BitBucket.
Any idea where this is coming from and how to solve this issue?
Not sure if this helps in the tracking down of this problem, but here goes anyway:
I have been connecting to a local network git repository perfectly well for a number of months, but I encountered this problem later yesterday and nothing I did seemed to improve the situation. That included:
Rebooting both the development machine and the server;
Reinstalling Xcode from the App Store;
Re-cloning the project from the git command line (which could see the repository perfectly well);
Checking out the repository from Xcode (I was able to check out but every other operation, such as , Commit, Refresh Status etc. seemed to cause the problem...)
Manipulation the repository with SourceTree (which could also see it fine).
Eventually I stumbled across a solution to my local issue. If I launch Xcode with a wired and wireless network enabled then I can't see the repository. If I close it, disable wifi and relaunch it then I can.
I've not had much opportunity to work out what the difference is (especially as the wifi connects to the same network and is the secondary choice for networking) but it does seem to fix it.
Hope that might help others and hopefully I can find a real explanation soon!
Dave,
Well it seems this had nothing to do with Bitbucket.
The problem was a messed up .git folder on my machine.
My project resides in a Dropbox folder. Somehow, perhaps because of accessing it from different machines, it created copy/duplicate files in the .git folder and it messed up Git. After fixing all the conflicts Git returned to working as usual and I was able to commit from Xcode to the remote repository.
Now, if you encounter this issue, you might not have the same setup as mine or work on Dropbox or any similar service, but I strongly recommend checking your Git folder thoroughly. Good chance something is messed up there.
Check internet connection of system.also quit xcode and reopen it.

Resources