Git on the Centos Server


You are here:
< Back

/*******
SERVER
********/

 

  • Login in to your server:

ssh login@your_domain_name.com

  • Install git package:

$ sudo yum install git

  • Create user folder and nessesery files:

$ sudo adduser git
$ su git
$ cd
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

  • Create empty repository:

$ mkdir repository_name.git
$ cd repository_name.git
$ git init -bare
$ logout

 

/****************
LOCAL MACHINE
*****************/

 

On your local machine:

  • Clone your repository

$ git clone git@oldrepository_url:repository_name

  • Push your repository to new server

$ git push –mirror git@your_domain_name:repository_name

  • Change settings in your local repository

git remote set-url origin git@your_domain_name:repository_name
git push –set-upstream origin master