Oct 28

I’m on OS X — Windows users may be able to use this as a general guide only. The command lines will not work for you.

1.Install Git for Mac OS X

2. Open up Terminal and type:

  • $ cd ~/.ssh
  • $ ssh-keygen
  • <enter> // defaults to id_rsa
  • <passphrase>
  • <passphrase again>

3. Type ls -l

  • You should see two new files, id_rsa and id_rsa.pub

4. This generated a public key (in id_rsa.pub) that you need to enter into ProjectLocker so it can authenticate your machine. You can copy it’s contents to the clipboard with the following command:

  • $ cat id_rsa.pub | pbcopy

5. Go to ProjectLocker and create a free account (you can always upgrade later)

6. Add a project, and choose ‘Git’ as the type

7. Click ‘Manage Public Keys’ on the left and add a new one:

  • Name: <name_your_machine> NOTE: This can be anything — a machine identifier of your choice
  • User Name: <user name> NOTE: You MUST use the username you used to create the identifier on your machine. It should be listed at the end of the public key, like alias@machinename.local
  • Key: Paste (You should have the key on your clipboard already from step 4) NOTE: verify that the username at the end of this key matches what you put in the ‘user name’ field

8.Let’s test it! At Terminal, type:

  • ssh git-@free1.projectlocker.com

You should get something like this in response:

PTY allocation request failed on channel 0
ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
Connection to free1.projectlocker.com closed.

That’s OK! That’s what we wanted!

9. In ProjectLocker, click, ‘User Home’ on the left, and copy the git location key that should look like this:

Your Git Location: git-username@free1.projectlocker.com:InitialprojectName.git

10. In Terminal, nagivate to the directory where your project is you want to commit. Then type the following commands:

NOTE: That before you do your ‘git add *’ coming up, you can create a file in the repo root called .gitignore and add any files/folders to it that you want to ignore. For example, mine looks like:

.DS_Store
build

Now on to the commands:

  • git init
  • git remote add origin git-username@free1.projectlocker.com:InitialprojectName.git (Substitute <ProjectName> with your project name, and the Git Location key with the one you found in Step 9 above)
  • git add *
  • git commit -am “initial commit”
  • git push origin master

Now you should see it uploading! mine looked like this:

Counting objects: 199, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (171/171), done.
Writing objects: 100% (199/199), 3.66 MiB | 857 KiB/s, done.
Total 199 (delta 39), reused 0 (delta 0)
To git-username@free1.projectlocker.com:ProjectName.git
* [new branch]      master -> master

11. Now back in ProjectLocker when I navigate to my project I created I see all my files checked in there!

Post to Twitter

2 Responses to “Getting started with Git and ProjectLocker”

  1. Michael Rowe says:

    When I follow these instructions it keeps asking for my password. I have tried my ProjectLocker password and the pass phrase of my RSA. neither seem to work. I know my project locker password is correct, since I log on to project locker with it. Any suggestions?

  2. Marcus Wagner says:

    @MichaelRowe I got the same problem. I investigated using:
    ssh -vi ~/.ssh/id_rsa_projectlocker git-username@free1.projectlocker.com (with own values for the key name and the URI) and it seems, that the git command only uses the id_rsa file for ssh key authentication. As soon as I changed the file name to plain id_rsa it worked.

Leave a Reply

 
preload preload preload