Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing over SSH to a GIT repository with Xcode 4.6

Tags:

git

xcode

ssh

I am using Xcode 4.6 to develop my projects and I am using the local repository feature. However I would like to be able to push my repository to a remote ssh server.

I have tried the following but it did not work : I went to the organizer and then to my repository, I have then added a new remote with the following instructions : - Name : Just a name so I have put my project name - Location : I have put a ssh path : user@domain:path_to_my_.git_folder

Then I have entered my ssh password, but there was no confirmation button though.

Once all this was done I returned to the development window and went to File->Source Control->Push but it says there is no remote found.

So I would like to know what should I do to make it work.

Thank you.

like image 640
Valentin Mercier Avatar asked Oct 04 '22 02:10

Valentin Mercier


1 Answers

I have found the best solution for repo's on github and bitbucket is to create an SSH key-pair with no password.

$ cd .ssh
$ ssh-keygen -t rsa -b 2048 -f github_id_rsa
$ vi config

Then add the following:

Host github
    HostName github.com
    User git
    IdentityFile ~/.ssh/github_id_rsa

And to then refer to the repo as:

ssh://github/trojanfoe/myrepo
      ^^^^^^
(note that's the name of the "Host" from the config file, not github.com)

This works well in Xcode, however I see "green lights" next to the repo during a pull, but "red lights" next to the repo during a push (this might be a bug in Xcode 5.1 beta), but it works without complaint and without the need for a password, which is great if you use Jenkins to do your release builds.

The Repositories under Preferences > Accounts cannot connect using the ssh alias either, but strangely they function just fine when performing Source Control operations:

enter image description here

like image 182
trojanfoe Avatar answered Oct 10 '22 14:10

trojanfoe