Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reconnect my project to my existing GitHub repository

Tags:

git

clone

github

I am working on an Xcode project with source control. I messed up so I deleted the project from my laptop, and downloaded (ZIP) my own project which I pushed to GitHub earlier. But now this cloned project is not a git repository (or any of the parent directories): .git

Question: How do I reconnect my project to my existing GitHub repository?

like image 604
abacaba Avatar asked May 21 '15 05:05

abacaba


2 Answers

The easiest is to:

  • clone your GitHub project
  • cd in that local clone
  • do a git --work-tree=/path/to/unzip/project diff to check if your zip has any differences with the version cloned from git hub: if it does, git add and commit. (and by that use git --work-tree=/path/to/unzip/project add -A . and then a simple git commit, to record the differences from the zip version of the project and the git cloned one)
  • resume working with the local clone (which is a git repo)
like image 55
VonC Avatar answered Nov 15 '22 18:11

VonC


Another option is to clone the git repository somewhere, and then copy the .git directory from there in to your project folder.

This folder will then become a git repository, and you can do git status and all the usual commands to do what you need to do.

There are probably some caveats, but it worked well for me in a situation where moving the project folder would have been difficult.

like image 32
cedd Avatar answered Nov 15 '22 16:11

cedd