How to use GitHub for Mac with local Git repo

21,300

Solution 1

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.

Solution 2

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.

Solution 3

If you don't want to publish your code on github but do want to use the github tools, you could pay for private repositories:

https://github.com/plans

then you can use the github tools and still keep your code to yourself. Otherwise, you'll have to use something other than the github mac application to handle your git workflow:

Solution 4

Clone your repository in the command-line, then add it to GitHub.app as a local repository. That seems to work for me -- it looks like GitHub.app is successfully reading the origin from the .git/config file and using it to sync.

Share:
21,300

Related videos on Youtube

Kevin McCarpenter
Author by

Kevin McCarpenter

Updated on July 09, 2022

Comments

  • Kevin McCarpenter
    Kevin McCarpenter almost 2 years

    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?

  • Kevin McCarpenter
    Kevin McCarpenter about 12 years
    Our organization does not allow code to be hosted outside of our walls at all. We will probably just switch to a different client. Thanks.
  • Kevin McCarpenter
    Kevin McCarpenter about 12 years
    OK, I suspected this was the case, though I was hoping I was wrong. Thanks for your input and suggestions.
  • learnvst
    learnvst about 12 years
    Yeah. Its a shame as it's a nice tool, but they are in business at the end of the day.
  • learnvst
    learnvst about 12 years
    Thanks for the comment. How embarrassing for me to get the answer so wrong! I haven't looked at this for a long time and I tried it this morning with mixed results. The answer has been updated to reflect my findings.
  • surfer01
    surfer01 over 9 years
    This may have changed recently. Following these instructions you will find the Sync button says "Publish;" clicking it will try to publish the repo on your github account. Instead, after adding the remote via Settings, Cmd+P (or use the Repository menu) to do a Pull.

Related