I believe git, somehow, was uninstalled during an update of OS X. I have reinstalled git and I want to re-sync my local development folders to the appropriate github repos but am not sure how.
I have since created a new repo so my github account is linked properly, but I don't know how to link the existing stuff.
For example, say one project is located at:
and it's corresponding github SSH location is at:
How do I get these synced back up?
When you say that "git was somehow uninstalled", I assume you mean you cannot use the command
git and you get
-bash: git: command not found error. So the following should help.
The first thing to do is type
which git and that will tell you if its included in your path. If nothing is prints, then you know thats your first problem:
The solution to these problems, obviously, is install it or find it on your system. Typically on Mac OSX, it is found in
/usr/bin/git. Add it to your
$PATH like so:
/user/bin with the directory where you find
gitrepository still exists?
Now, check that the is repo didn't get destroyed. Most likely, it did not.
$ cd project/ $ ls -la drwxr-xr-x 3 user staff 102 May 24 18:31 . drwxr-xr-x 6 user staff 204 May 24 18:31 .. drwxr-xr-x 9 user staff 306 May 24 18:31 .git -rw-r--r-- 1 user staff 119 May 24 18:34 README.md
The presence of the
.git directory means it still exists, therefore finding/installing
git is your only problem. As soon as you fix that problem, you should be able to use
git exactly how you used to.
However, if the
.git file is gone (highly unlikely), there are several things you can do.
Good luck :)
I think even if git was uninstalled, the repo didn't lose its identity. Did you try
git status command on that repo? What does it say? Moreover I would try
git init & adding remote after taking a backup.
Git repositories are just collections of files, independent of the Git tool itself. Uninstalling Git does not delete the repositories, so your old origin is probably still there.
cd /users/stephen/development/cs git remote -v
If you see your old origin, point it to the new location:
git remote set-url origin [email protected]:stephen/cs.git git fetch origin
If you don't see your old origin, add it...
git remote add -f origin [email protected]:stephen/cs.git
...and set up the trackers for existing local branches:
git branch --set-upstream master origin/master git branch --set-upstream another-local-branch origin/a-remote-branch-to-be-tracked etc.