Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use SSH with ProjectBuilder's SCM feature UNIX
This document describes how to set up CVS using SSH on a client computer and using Project Builder's SCM feature for version management. It assumes that CVS and SSH are already set up on the server that you will be checking your code out from. It is desirable to use SSH because CVS transmits usernames and passwords in clear text otherwise.

If you'd like the how-to, read the rest of the article...

Setting up CVS on Mac OS X using the bash shell
  1. Set your .bashrc file to know about the CVS server by adding the following lines to ~/.bashrc on the client machine.
    export CVSROOT=:ext:username@remotehost:remote_path_to_cvsroot
    export CVS_RSH=ssh
  2. Set up your ssh key using ssh2
    ssh-keygen -t dsa
    (accept the default file and enter a passphrase)

  3. Physically transfer the file ~/.ssh/id_dsa.pub to the CVS server and add it to the contents of ~/.ssh/authorized_keys2.

  4. Set your .bashrc file to start up the ssh-agent so that you won't need to type a passphrase to access the CVS server. Add the following line to ~/.bashrc on the client machine:
    alias ssh-add='ssh-add $HOME/.ssh/id_dsa'
To get a CVS directory from the server
Open a new Terminal window and type the following (path is the path to the project you wish to get from the CVS server):
eval `ssh-agent -s`
ssh-add [ then enter passphrase ]
cvs checkout path
To use SCM from within Project Builder
Project Builder needs to be able to access the ssh-agent that was started in your terminal session above, so you must launch Project Builder from the terminal and keep the terminal window open during your Project Builder session. From the terminal, type:
open /Developer/Applications/Project Builder.app
If you are beginning from a fresh terminal session, you will need to do the following:
eval `ssh-agent -s`
ssh-add
open /Developer/Applications/Project Builder.app
Caveats and Gotchas
  • Every time that you run the ssh-agent command, the agent lives even after the terminal window that opened it is closed. This is a bummer. It would be nice to find a way to make ssh-agent the parent of every process, but my attempts to patch it into the login process didn't work. I tried using -LoginHook, modifiying the loginwindow process, modifying the Finder process, and changing the 'Finder' key in loginwindow.plist. I'm up for suggestions... Fixing this would also allow one to launch Project Builder from the Finder instead of needing to do it from the command line. Since the ssh-agent doesn't die, we might as well add the following to our .bashrc file so we don't have to type it every time we want to code something:
    eval `ssh-agent -s` > /dev/null
  • I'd personally prefer to do this using SSH version 1 instead of version 2. But I don't care enough to switch 'em. If you're using version one, just use ssh-keygen (with no arguments) instead of the command I gave above and physically transfer the file identity.pub to the server computer instead of id_dsa.pub. Also, you won't have to make the alias for ssh-add.

  • If you're using tcsh, change the 'export's to 'setenv' and stick an '=' in between the thing being defined and its definition.

  • You may want to add an alias for Project Builder to your .bashrc file so that you can launch it a bit more easily. For example:
    alias ProjectBuilder='open /Developer/Applications/Project Builder.app'
(c) 2001, All Rights Reserved, Jason Harris
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[8,684 views]  

Use SSH with ProjectBuilder's SCM feature | 7 comments | Create New Account
Click here to return to the 'Use SSH with ProjectBuilder's SCM feature' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
ssh-agent for each terminal window
Authored by: Benad on Nov 13, '01 08:53:08AM
If you do something like:
ssh-agent tcsh
ssh-add
then the ssh-agent will exist only until you enter exit. You can replace tcsh with any shell you like. - Benad

[ Reply to This | # ]
ssh-agent for each terminal window
Authored by: smeger on Nov 27, '01 03:23:35PM

yup, that works! Thanks for the tip!



[ Reply to This | # ]
How to use Project Builder's CVS over SSH with SourceForge
Authored by: carsten on Jan 04, '02 08:19:03PM

This is awesome! This means it is possible to use Project Builder with SourceForge.net, which requires CVS access via SSH (Project Builder defaults to RSH). So I wrote up some modified instructions to set up Project Builder for use with SourceForge:

How to use Project Builder with SourceForge (Mac OS X)

Project Builder 1.1.1 (December 2001 Dev Tools) can be used with SourceForge's CVS but a little work is needed to get it set up the first time. The following instructions were based on a tip from macosxhints.com.

Preparation

Make sure that your ssh keys have been uploaded to your account at SourceForge and that you can sucessfully ssh into your account. Next, ensure that you can check out your project from SourceForge using the unix command-line based CVS tools provided by Mac OS X.

Instructions

1. Download and install "keychain" from:
http://www.gentoo.org/projects/keychain.html

The Keychain script acts as a front-end to ssh-agent, allowing you to easily have one long-running ssh-agent process per system, rather than per login session. This dramatically reduces the number of times you need to enter your passphrase, from once per new terminal window session to once every time your local machine is rebooted. It also allows you to use Project Builder with SSH instead of RSH. SSH is required if you want to commit files to a CVS repository at SourceForge.

2. If you use the default tcsh shell or csh, add the following to your .cshrc file:

<code>
setenv CVS_RSH 'ssh'
# Keychain is an OpenSSH key manager
# This will add my SSH1 and SSH2 key
/usr/bin/keychain ~/.ssh/id_rsa ~/.ssh/id_dsa
source ~/.ssh-agent-csh-${HOST}
# Alias to servers via SSH
alias sshsf 'ssh mysfuserid@phpwiki.sourceforge.net'
</code>

If you use bash instead, add following to the .bashrc file:

<code>
CVS_RSH=ssh; EXPORT CVS_RSH
# Keychain is an OpenSSH key manager
# This will add my SSH1 and SSH2 key
/usr/bin/keychain ~/.ssh/id_rsa ~/.ssh/id_dsa
source ~/.ssh-agent-${HOSTNAME}
alias sshsf='ssh mysfuserid@phpwiki.sourceforge.net'
</code>

3. Close the terminal window then open a new one. Keychain will activate ssh-agent which will ask for your ssh key password. It keeps running in the background and won't ask for your password again until you log out or restart.

4. From now on, <strong>YOU MUST open Project Builder from the Terminal shell for it's CVS to work with SSH</strong>. This is why we created a command alias in .cshrc to launch Project Builder. If it is already running because you double-clicked the PB icon, quit it, then launch it from the terminal by typing pb. <em>Once PB is running you can safely double-click a project file to open it</em>.

Using the above method, ProjectBuilder will successfully connect to the Sourceforge CVS with SSH. Any other server which requires cvs connections to be made cia ssh instead of rsh should now work too.

If you have a ".cvsrc" file in your home directory, remove any configuration line which enable CVS compression. SSH usually already has compression enabled, so an extra layer of compression just slows down the whole CVS process when Project Builder is used over SSH. (At least it did for me at SourceForge, with cable modem and G4 DP-450).

Example contents of my ".cvsrc" file:
diff -u3
cvs -z6 <--remove this line
update -d

Note: Renaming /usr/bin/rsh to something else and replacing it with ssh doesn't seem to work; Project Builder simply MUST be launched from the command line for it to work at all with ssh.

Hopefully Project Builder's integrated CVS will be improved in the future to directly support SSH. Send an email to: macosx-tools-
feedback@group.apple.com to let the team know that full support for SSH in Project Builder is important.



[ Reply to This | # ]
oops I made a mistake
Authored by: carsten on Jan 04, '02 08:28:08PM

This line:

alias sshsf 'ssh mysfuserid@phpwiki.sourceforge.net'

should read:

alias sshsf 'ssh mysfuserid@mysfproject.sourceforge.net'

Of course you will substitute your own SourceForge Userid and Projectid in place of "mysfuserid" and "mysfproject". (phpwiki is just the name of a project I contribute to at SF).



[ Reply to This | # ]
ssh-agent reused
Authored by: osahner on Feb 17, '02 06:41:40AM
I did a small (bash) function that avoid starting mutiple ssh-agents.
Just add the following code to your ~/.bashrc
#############################################
function sshagent () {
	SSHAGENT_ENVFILE=~/.ssh/ssh-agent.sh
	
	if [ "${1}" = "stop" ]; then
		echo -n "SSH-AGENT: "
		eval `ssh-agent -k`
		if [ -e "${SSHAGENT_ENVFILE}" ]; then
			rm ${SSHAGENT_ENVFILE}
		fi
	else
		echo -n "SSH-AGENT: "
		if [ -e "${SSHAGENT_ENVFILE}" ]; then
			source "${SSHAGENT_ENVFILE}"
		else 
			ssh-agent -s > ${SSHAGENT_ENVFILE}
			source "${SSHAGENT_ENVFILE}"
			ssh-add ~/.ssh/id_dsa ~/.ssh/id_rsa
		fi
	fi
}

sshagent start
##############################################
Now everytime you open a new Terminal the function checks if there is already a running ssh-agent. If Yes source the ENVIROMENT stored in ~/.ssh/ssh-agent.sh else start one.

[ Reply to This | # ]
SSH and PB the nicer way...
Authored by: nullchar on Feb 17, '02 10:25:21PM
Well I don't think I am alone on this one so I will share what I managed to hack up for myself and my ssh-agent. I use ssh agent all the darn time and without it I would be completely lost. I was really at a loss trying to figure out how to have all Mac OS X applications inherit my agent without starting them from a terminal. Especially since this is so easy to setup under OpenBSD.

So anyways today I figured it out. Basically a small shell script which is executed by LoginWindow and all my apps now inherit my agent. Yes Project Builder started from the dock works as well ;)))

Here how todo it.
1) Download this small script I made.
Agent Startup Script

2) Modify your /etc/ttys as root ( or sudo ). The following is what is before and after...
console "/System/Library/CoreServices/loginwindow.app/loginwindow" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.9600"

to this

console "/System/Library/CoreServices/loginwindow.app/loginwindow -LoginHook /Script_Location" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.9600"

3) Make the script executable
chmod 755 /Script Location

4) Reboot

5) Startup your terminal to verify if everything went alright by doing setenv | grep -i SSH if you are using tcsh or
set | grep -i SSH in sh/bash.

You should see something along these lines
SSH_AGENT_PID=274
SSH_AUTH_SOCK=/tmp/ssh-xczKJ273/agent.273
6) If you see the above then all you need todo is add your keys into the
agent with ssh-add.

Once that is all done you can launch Project Builder, completely quit Terminal and your agent will still be around and will automatically be
sourced in the way it should be...

For a bit more detailed info and listing of possible problems you can go to
http://www.unixkb.org/MacOSX/


[ Reply to This | # ]
SSH and PB the nicer way...
Authored by: The DJ on Jun 02, '02 07:46:16PM
Better tools are available now. Check this.

[ Reply to This | # ]