Putting New Project on Git Server

May 21, 2008

Details on how to move new Git project onto my git server so I can use this as a central location for my work.

With an existing new project (we will use ‘tc’) which is already under git do the following in the directory above the project

  • ensure the project has no pending work. git status should show nothing outstanding
  • move to folder above the project
  • clone the project (in this case we will clone tc to make tc.git)

      git clone --bare tc/.git tc.git
    
  • move the clone to the git server

      scp -r tc.git deploy@little-un:/srv/git/
    
  • I have to do this as the deploy user (my Git user does not have sufficient rights) so I need to ssh to the server cd to /srv/git and change ownership

    sshlun
      little-un > cd /srv/git/
      little-un > sudo chown -R git:git tc.git
    

Now we dump the local repo and clone a new one from the remote one.

cd ..
mv tc tc.old
git clone git@little-un:/srv/git/tc.git