Where is the repository picker in my Git GUI? - windows

I have just started using GIT and for some reason every single time I click to open GIT GUI I can't see the repo picker, it just goes to the repository screen and shows it's in C drive.
Does anyone know how to over ride this so I can pick my repo every time it opens like normally?
Thanks

If you are talking about the git gui command, it opens a repository determined by your current working directory. If you are outside a GIT_WORK_TREE, then you will see a dialog that allows you to select a repository.
If you're using some other tool, you will need to update your question to get a better answer.

Related

How do I sync an Xcode project between two Macs locally?

I have an Xcode project on my MacBook Pro, with a git repository stored locally. I have an iMac also, and I would like the project to sync between the two computers. I understand this is possible with git and source control, but I don't understand exactly how to do it. I also have a USB flash drive connected to my router, which both machines can access. Is there a way to clone the git repository to the flash drive (making it a remote repository?), then have both machines push and pull changes to it? Also, would the flash drive need to be a bare repository? What is the specific terminal code to do this? Thanks.
I found the answer to my question by trial and error. I created the repository file on the flash drive that is plugged in to my router. On the Mac that has the project and git repository on it:
Open Terminal, and type cd. Put a space after cd. Locate the folder you want the git repository to be in (in my case, the one created on the flash drive). Drag it from the Finder window into the Terminal window. It will type out the path to the folder for you. Press return.
Type git init --bare, press return. A bare git repository will be created in the file you specified in the first step.
Type cd, put a space after it, then drag the project folder that you are creating the git repository for into the Terminal window. Don't drag the project file, such as "Test.xcodeproj". Drag the whole project folder that the file is in, such as "Test". Press Return.
Type git remote add origin //. Drag the folder with the git repository you created in steps 1 and 2 into the terminal window. Press return.
The new bare git repository should now be created and linked in your Xcode project as a remote repository. Once that's done, copy the whole project onto your other Mac. To pass information between the two computers:
In Xcode on either Mac, click "Source Control>Commit...". In the lower left corner of the commit window, check the box that says "Push to remote." Click "Commit".
On the other Mac, open Terminal. Type cd, put a space after it, then drag the project folder into the Terminal window and press return.
Type git pull, and press return.
You should now have any changes you committed to Source Control on both Macs.
As of the writing of this answer, when "Source Control>Pull..." is clicked, Xcode crashes. This would be an easier way to pull changes than using Terminal, once that bug is fixed.
As an alternative to a local flash drive or network git repository:
You could setup a remote repository on one of the internet based git servers such as Bitbucket or GitHub (both of which offer free accounts with certain restrictions). Then sync your two macs to the same remote.
This has the additional advantage of providing a third location for your code and additional access methods such as web access or iPad access from an App such as Working Copy.

Pushing Images to Git Repo from Xcode

So this problem already helped me solve another one of our issues, but I still haven't figured this one out. (This is relevant. Hold on.)
I am developing a game with one other person. Neither of us have ever used git repositories, Github (for more than reference) or any sort of version control before, and we've had some trouble getting set up.
We have our project set up in Xcode with remotes to a GitHub repo, and everything is working fine with the code. The problem is that we can't get our images (buttons, backgrounds, animations etc.) to commit to our local repo without resorting to one of two, very roundabout, methods.
Right click on our Assets group in Xcode and select Add Files to Project. I have to do this every time we add images anyway. Then, to get Xcode to realize that these are files that need to be added to the repo (at least to get the A indicator next to the files in the organizer) we have to go in and add a blank Objective-C class, then right click the images > Source Control > Add. Then delete the blank class.
Use the GitHub app to commit the project and push it from there. This isn't working because Github's .gitignore doesn't include the xcode preference files. This makes the project unable to commit from Xcode on any other machine, and even from the machine the commit was made from after a reboot. (This is the problem we figured out trying to commit images.)
So my question is: How do we share assets for the game? I figure that Xcode will do the same for sounds, we just haven't gotten there yet. Is there an easier way to get Xcode to recognize them? Or do we just need to add those user profile files to the .gitignore on GitHub? (And how do we do this?)
Every one using Git just has to watch these two videos:
Git For Ages 4 And Up
http://www.youtube.com/watch?v=1ffBJ4sVUb4
Advanced Git
http://vimeo.com/49444883
1) I've found the best way to add images to my Xcode project is to just create the directory structure I want in the Finder then just drag and drop them from my finder in to the proper group in Xcode Project Navigator. Multi select all the new files, right click (control-click on a laptop) and select Source Control -> Add
And Bobs your uncle!
2) I do not use the GitHub app, I use SourceTree and the GitHub website. I've 20 years experience with command line source control systems but Xcode and SourceTree are so good the command line is no longer a part of my daily workflow.
I create a new Xcode project and check Create local git repository for this project then I go to the GitHub create a new repository with the same name as my project's top level directory. Copy the GitHub url. Drag the new project directory into SourceTree's Bookmarks window. Double Click on the new project view in SourceTree. Right mouse click on REMOTES and paste the GitHub url and enter origin/master for the name. Click the big push toolbar button.
3) You need to add your user scheme and workspace file to .gitignore to push and pull from a remote you have to have a clean working repo. This is super simple with SourceTree just commit in Xcode and then open the project in SourceTree right click on the WorkspaceSettings.xcsettings and *.xccheme file and select Ignore... and it creates the .gitignore file for you. Now commit the .gitignore file and Push to the remote.
FYI: Check out SourceTree (http://www.sourcetreeapp.com) is's free in the Mac App Store. It's a very good GUI for Git. Atlassian makers of Jira acquired it and the original developer and released free to compliment the rest of there tools.

GitHub (Mac application) - commits not visible

I have just recently installed the github mac application and attempted to push some existing commits to a branch using the Synchronise button. I am authenticated with SSH keys, the application did not complain and it seemed to work. However, when inspecting the remote repository on github.com I cannot seem to find my commits anywhere, not in the history of the branch or individual files. It's as if I had committed nothing.
However, inside the GitHub app i can click on the "view on github" button and it will inspect the commits and show the diffs etc. correctly as if i had navigated to them on the website.
Does anybody know why this may be happening? Apologies in advance if this is a trivial problem!
Thanks
I'm not sure if I understand your question right, but did you first commit and then use the sync button?

Add Xcode project to github repo?

I have JUST created a new github repo on the website. Keep in mind that I am a noob but can do basic things in terminal. Anyway, so I just created the repo on my account on github.com and didn't do a single thing to it yet.
So all I want to do is take my Xcode project folder and upload it to my new github repo. How do I do this via terminal?
The best way really is to follow the instructions GitHub gives you:
First, go the correct directory
cd <directory of your Xcode project>
It sound like you've already got a local Git project from Xcode. If that's true, skip this code block.
git init .
git add .
git commit -s
<type in a commit message>
Last, push into your repository. The following is copied directly from my own github account, after I created a new "test" repo. Change the "dhalperi/test" part.
Push an existing repository from the command line
git remote add origin git#github.com:dhalperi/test.git
git push -u origin master
I was just going to leave a comment above but I will also add a summarized answer. My full answer is here.
This isn't via terminal as the question requests, but you can consider this an alternate method. It is well integrated with Xcode now, though, and not difficult to do.
Create Git repository when making a new project
See the answer I linked to above if you already have a project without a Git repository.
Make a Commit
After making a change in your project, select Commit... from the Source Control menu. You will add a short commit message.
Create a new GitHub repository
On the GitHub website make a new repository. Call it whatever you want, but don't add a README or .gitignore or license yet. After creating the new repository copy the link to it.
Add a Remote in Xcode
in Xcode go to Source Control > your branch name > Configure. Then click the Remote tab > "+" button > Add remote. Fill in your repository name and address.
Push your project to GitHub
Go to Source Control > Push. You will have to enter your GitHub user name and password the first time.
That's it. Now any time you make changes in Xcode, all you have to do is Commit and Push.
If you didn't follow this explanation, please read this and this for more detail.
Further Study
This is an excellent video that I recently watched that helped me understand Git and its integration with GitHub much better.
The Basics of Git and GitHub
An easier way to do it in Xcode.
You can even push only one current branch to GitHub or the whole project.
(for Xcode 11)
Just select a needed branch/(or top folder) in "Source control navigator" and right-click on it. Then select "Create remote". Or "Editor -> Create remote".
Then use your account at GitHub to create the repository. If using your GitHub account is not proposed maybe you still not add your GitHub account in Xcode -> Preferences -> Accounts
After everything is set up. Click "Create".
To push your project/branch to GitHub repository click "Source Control -> Push".
After that check Github. All should be there.
Get the Github Mac Application, you don't really need a terminal unless you want to do more fancy advanced stuff ;-)
Simply go to your project page on GitHub, then click on "Clone in Mac", this should automatically download and install it for you. You have to do this at least once to install the app and setup some required permissions.
After that, you'll see the GitHub Application in your Dock, simply open it, then click on that small "+" sign at the bottom, there you'll see "Create New Repository" and "Add New Local Repository".
You can either add the repository that XCode already created for you or download one from GitHub, then open it in XCode.
if you already have a git repo on your Mac and using Xcode 9,
for xcode 9, just go to the source control tab in the navigation inspector in Xcode. right click on the master git and select create "Your project name" remote on GitHub.
give your GitHub credentials and give a name to git repo and Xcode will create and push your code for you.
a non terminal solution is to install SourceTree. Its a GUI thats super easy to use compared to the terminal. But its highly recommended to learn git commands properly.

Xcode/Git Repository Error: "Please verify that the working copy is reachable and try again."

Here are the steps I take.
I open Xcode (4.3.3) organizer and select Checkout or Clone Repository
I choose the location https://MyUsername#bitbucket.org/MyUsername/myrepo.git
Press Clone button and it successfully clones it on my local disk
So I open the local copy of the project and perform some changes to it.
When I try to commit changes (or do any other git related operation) I get the following error:
The working copy "MyAppName" could not be reached.
Please verify that the working copy is reachable and try again.
However I can perform commits (and other types of git operations) without any issues from the Terminal app using command lines.
I've tried restarting my computer, deleting all Xcode settings, but nothing helped.
Update: I tried it again today and it works fine now. Maybe it's some sort of an intermittent bug in Xcode.
Whenever this happens to me (and it happens often) I do the following:
1-Close the project
2-Open the organiser
3-Go into the repositories tab.
If your current working copy has been added to the list already, then within the organizer navigate to it, and double-click on the .xcodeproj project.
This will re-open the project in XCode, and you'll find that now SCM operation will work fine.
If your current working copy hasn't been added to the list, press the + button in the bottom left corner, select "Add Working Copy", navigate to the folder containing the .xcodeproj and open this folder.
Now double click on the .xcodeproj file, the project will open in XCode.
And it's all working fine again...
No idea why this make things work... but it does
I have the same problem. It happens if you have ~/ in the path to project. Works fine, when you open your project from organizer.
It's a bug of Xcode! When you search the xxx.xcodeproj from your Home folder of the dialog box directly, Xcode will use the ~/xxx/xxx as the SVN/Git path which is completely wrong.
So you should avoid this, and search from the "/" path instead.
This is not exactly the answer you might be looking for, but I ran across similar problems when using Remote git repository (Github) and Xcode.
I ended up using a GUI tool "SourceTree", a good and easy to use tool to pull/push your code from Local Git to Remote Git Repository. Try it out http://sourcetreeapp.com/

Resources