Knowledge base | projectlocker

How do I connect to my Git Repository?

ProjectLocker supports Git over HTTPS as well as SSH. Over HTTPS, you can get your URL by doing the following:

  1. Log in to Portal and click the Projects link in the top menu.
  2. Click the "Click To View" link next to your desired project.

You should see a window like the following: 

 The above example is for account PLScreencast, project GitCreateDemo, which lives on server 2. You can substitute your account name, project name, and server accordingly.

 Over SSH, Git requires public key access. Your public key must be installed with ProjectLocker in order for you to receive access. In order to install your public key:

  1. Click Users to get a list of users and click the user login, or click on the user's login shown in the Project detail page.
  2. Click Git Public Keys on the left.
  3. Select the New Key button on the upper right.
  4. Enter the name, user name, and key contents per the instructions on the page, and press Save Public Key.

In a few moments, your key will be posted to the Git server.

 Git uses public key authentication to access your repository. If you are being asked for a password, it means that your public key isn't communicating properly. To connect to Git for the first time, do the following:

Mac OS X / Linux

  1. Open a terminal window as the Unix/Mac user you wish to access Git with.
  2. If you don't currently use key pairs:
    • Run ssh-keygen -t rsa to generate an RSA key. You can use other flags to customize the number of bytes your key is.
      Accept the default name for the key by hitting return when asked and use a blank passphrase by hitting return when asked. 
    • Your public key should be in a file named id_rsa.pub in your ~/.ssh directory. 
  3. If you already have a key pair:
    • We recommend generating a new one for ProjectLocker so you don't disturb any existing configurations. Separate keys for different services is also more secure, as one key getting compromised means your other keys remain safe to use.
    • Follow the instructions for generating a new key pair above, but instead, enter "~/.ssh/projectlocker" as your key name when asked.
    • Your public key should be in a file named projectlocker.pub in your ~/.ssh directory
  4. Create or edit your ~/.ssh/config file with the following settings:
        Host projectlocker 
            HostName [replace with your ProjectLocker server, e.g. pl2.projectlocker.com] 
            User [replace with "git-", followed by your account name, e.g. "git-myaccount", NOT your individual ProjectLocker login]
            IdentityFile ~/.ssh/[replace with name of key you just created] 
    Example:
        Host projectlocker
            HostName pl1.projectlocker.com
            User git-myaccount
            IdentityFile ~/.ssh/projectlocker 
    This tells your computer to use your ProjectLocker key when communicating with ProjectLocker, even if it uses other keys for other servers.
  5. Take this public key and upload it to ProjectLocker using the Manage Public Keys link. To upload the key, copy the full text from the key into the "Key" text area on the Manage Public Key page.
  6. Run "git clone git-[account name]@[server].projectlocker.com:[project name].git". This should clone your repository and create an empty local copy.
  7. Add the desired files and check them in using Git. You can use "git push" to send the files to the server when you are ready.

 Windows

We recommend msysgit as a straightforward client, but we also have instructions for the following clients:

msysgit

  1. Install msysgit (http://code.google.com/p/msysgit/) to your local machine.
  2. Open up an msysgit bash shell and run "ssh-keygen -t rsa" to generate a key. Accept the default name for the key by hitting return when asked and use a blank passphrase by hitting return when asked.
  3. Your key should be in a file named id_rsa.pub in your C:\Documents and Settings\[your user name]\.ssh\id_rsa.pub directory. ake this key and upload it to ProjectLocker using the Manage Public Keys link. To upload the key, copy the full text from the key into the "Key" text area on the Manage Public Key page.
  4. In the same shell, run "git clone git-[account name]@[server].projectlocker.com:[project name].git". This should clone your repository and create an empty local copy.
  5. Add the desired files and check them in using Git. You can use "git push" to send the files to the server when you are ready.

PuTTY Users

Windows users who use PuTTY already and manage public keys there can take the public key generated by PuttyGen, using the text shown in the "public key for pasting into OpenSSH Authorized_keys file" section.

You may need to attempt to SSH to the box once to accept the host key (the other tools don't present the host key), but just close the app after accepting the key.

Also, be sure to set GIT_SSH to your Plink installation's location. If your key is installed at ProjectLocker, Plink is your GIT_SSH, and Pageant is running, you should be able to use your PuTTY public key. We recommend msysgit's solution though, unless you have a specific reason to use PuTTY keys. 

Troubleshooting

If your keys don't work, make sure that you copied the true full text of the key, including the ssh-rsa or ssh-dss prefix and the user@host postfix. 

If you have followed these steps exactly and cannot access your repository, please include a copy of the following command in your Support Request:

  • ssh -vvv git[account name]@[server].projectlocker.com

This will help us debug what may be going on with your connection. If you see lines something like

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/[YOUR USER NAME]/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue:
publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering RSA public key: /Users/[YOUR USER NAME]/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply

near the bottom, it means that your public key is not configured correctly on our server and that you should verify that the user has the correct public key added. If you look at which private keys are being offered and don't see any familiar locations, it means your SSH client isn't looking for your keys where you put them and you should either create new ones or ensure that it looks in the right place. 

If you're sure your keys are set up correctly, the only thing left to check is that you are a member of the project. If you're an admin, you can add yourself to the project. If not, have an admin do it for you. If you aren't a member of the project, your key won't be made available to it and you'll get connection errors.