GIT – centrální repo

převzato z GitHub

##Create a git repo with a central repository server.

Step 1: Connect to server, create a new, empty directory there and initialize an empty repository.

$ ssh server.com
Last login ...
Welcome to server.com!
> mkdir myrepo.git 
> cd myrepo.git
> git --bare init
Initialized empty Git repository in ~/myrepo.git
> exit
Bye!

Step 2: Get into your source directory. If you did not already set up a local git repo you would have to do it now.

> cd myrepo
> git init
Initialized empty Git repository in ~/.git/

Step 3: Add the remote repository as origin repo to to your existing local git repo. Set the local master branch to track the remote branch. Then push to the server:

> git remote add origin user@server.com:/~/myrepo.git
> git push origin master

Finally you can now clone the server repo to a new directory by a simple

> git clone user@server.com:/~/myrepo.git

Further pushs and pulls can be done simply by call git push and git pull (origin master is not needed).

Posted in LINUX, různé