Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use GitHub for Mac with local Git repo

I'm trying to use a local Git repository (i.e. not hosted on GitHub at all), and I'm having troubles with GitHub for Mac.

It shows my outgoing changes, but then I appear to have to Push to the server, and there appears to be no way to perform a "Sync" without publishing to GitHub (which we don't want to do).

I haven't found any documentation regarding this, or users experiencing similar issues.

Any suggestions?

like image 452
Kevin McCarpenter Avatar asked Apr 17 '12 18:04

Kevin McCarpenter


People also ask

Can I run GitHub locally?

If you want to work with Git locally, but do not want to use the command line, you can instead download and install the GitHub Desktop client. For more information, see "Installing and configuring GitHub Desktop."

How do I clone a Git repository to a local folder Mac?

Cloning the RepositoryType in "Clone" and select "Github: Clone". Copy the "Clone with SSH" URL from the GitLab repository you would like to clone. Paste in the URL to clone first then modify the location to a folder that exists and that you will be able to access easily later.

How do I push a local repository to GitHub?

Perform a git init command in the root folder of the existing project. Add all of the existing project's files to the Git index and then commit. Add the GitHub repo as a remote reference for the existing project. Perform a git push operation with the -u and -f switches.


2 Answers

The application is a free tool to encourage you to use GitHub, and works best with GitHub, but it can also work with private repositories now as detailed in this excerpt from http://mac.github.com/help

Multiple Git remotes & non-GitHub remotes GitHub for Mac does not support multiple Git remotes. We will only work with the origin remote. If you wish to push & pull to other remotes, we suggest that you use the command line client.

GitHub for Mac is optimized to work with GitHub remotes — but if you wish to use a non-GitHub remote, it will work just fine. Set the remote manually in the settings tab and everything else should work as expected.

I have tested the latest [Version 1.2.6 (010d408)] software with some of my private non-github remotes and it seems to work ok with some fiddling. In theory, you should just be able to drag and drop an existing repository into the new repository pane. If the existing repository on your local machine has been set up to work with your remote from the command line, then it should work just fine in the GitHub software....

However, I ran into a few hiccups along the way. For example, the GitHub for Mac software refused to acknowledge one of my repositories. I would continuously drag and drop it into the Mac software and it would refuse to show up in the repository list. Sometimes, a random repository would pop up instead from my GitHub account! Some of my other private repos worked just fine, and I could circumnavigate the strange bug by manually moving the .git directory to another folder and then dragging the local repo into the Mac software pane. It would then offer to set up a new repo in that folder. After this was done, I replaced the new .git directory with my old backup. Even with this little problem fixed, I still occasionally get random errors dialogue boxes that inform me that there has been a "Git Error" when browsing commits, although this information appears to be just an annoyance, as all my commit information is displayed correctly. I normally work from the command line and am pretty sure that there was no problem with the setup of my git repo.

In summary, GitHub form Mac is awesome for Gitub based repos, but still not perfect for your own repos on different remotes. There are, however, other free tools such as gity and gitx that work on mac and allow you to use a repo hosted anywhere. I have not tried Tower, but it looks pretty awesome.

like image 91
learnvst Avatar answered Oct 05 '22 07:10

learnvst


I don't actually have a Mac to try this, so maybe I'm missing something glaringly obvious, but according to http://mac.github.com/help:

GitHub for Mac is optimized to work with GitHub remotes — but if you wish to use a non-GitHub remote, it will work just fine. Set the remote manually in the settings tab and everything else should work as expected.

so I presume in the settings you can do something similar to doing the following on the command-line:

git remote add origin some/shared/place/within/your/network

Then when you hit the Sync button it should use that it seems. I would guess that behind the scenes the Github client is simply using your project's .git/config file, so I'd be surprised if you can't edit your remote as you see fit.

See e.g. this post for a few different ways of setting up your shared remote.

like image 24
ngm Avatar answered Oct 05 '22 06:10

ngm