Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing existing git repository to gitolite

I've set up gitolite on my Ubuntu server and can add users, create empty repositories, clone the empty repository, add files, commit locally, and git push origin master to send it to gitolite.

I can also create a project in XCode4, with its own git repository, and commit changes locally.

Now I want to have another copy in gitolite (possibly so others can use, but also as another copy). This is where I'm stuck, and I'm a complete newbie to git (only really have used the XCode git functionality). Can someone direct me?

like image 765
Zeophlite Avatar asked Jun 22 '11 04:06

Zeophlite


People also ask

How do I push a local repository to a different repo?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

How do I create a Gitolite repository?

To add a new repo, you have to clone the gitolite-admin repository, then edit the conf/gitolite. conf file. In that file, add the repo, along with at least one user with some permissions.


2 Answers

You need to add another remote to your existing repository:

git remote add newremote [email protected]:gitolite_repo

These values will be changed to suit your needs:

  • newremote is the name of the new remote (it's like origin, which you've already been using.)
  • git is the username
  • gitolite.com is the server
  • gitolite_repo is the repo inside gitolite you want to use

When you want to push to origin, you can do that as you always have. When you want to push to the new remote you just do:

git push newremote branch
like image 171
User1578 Avatar answered Oct 05 '22 19:10

User1578


Using the information provided by User1578, I was able to add an existing repo to my development server's gitolite repo.

Steps involved:

  • Added the repo and pub key (if necessary) to gitolite
  • Edited the local .git/config
    • changed the [remote "origin"] url to my gitolite repo.
  • git push origin master

Your set up may be different, but I did not need (or want) another branch/remote. The old origin remote was dead anyway, so I did not need to keep it. Hope this helps someone else.

like image 36
Brendan Avatar answered Oct 05 '22 17:10

Brendan