Configure GIT & GIT HUB STEP BY STEP
##############Repo Server --Node:-1##############
#Add gituser -> su gituser
#create Directory
#mkdir project.git
#cd project.git
#git --bare init
-----------------------------------------------------------------------
User tom --> Node:-2
#useradd tom
#mkdir tom_repo
#cd tom_repo
#git init
#ssh-keygen
#ssh-copy-id ~/.ssh/id_.pub gituser@node1
------------------------------------------------------------------------
User Jerry --> Node:-3
#useradd jerry
#mkdir jerry_repo
#cd jerry_repo
#git init
#ssh-keygen
#ssh-copy-id ~/.ssh/id_.pub gituser@node1
############SETUP USER PROFILE ###############
-------------------------------------------------------------------------
Now working with user
tom#git init
[tom@node1 tom_repo]$ git config --global user.name "tom"
[tom@node1 tom_repo]$ git config --global user.email "tom"
[tom@node1 tom_repo]$ git config --global branch.autosetuprebase always
[tom@node1 tom_repo]$ git config --global color.ui.true
[tom@node1 tom_repo]$ git config --global color.status auto
[tom@node1 tom_repo]$ git config --global color.branch auto
[tom@node1 tom_repo]$ git config --global core.editor vim
[tom@node1 tom_repo]$ git config --global merge.tool vimdiff
[tom@node1 tom_repo]$ git config --list
echo "This is first code" > README
git status -s (show file status )
git add . (ADD this file in git place)
git commit -m "comment according to situation"
git log (history)
Now this file is push in remote server (GIT REPO SERVER)
#add git remote server [tom@node1 tom_repo]$
git remote add origin gituser@192.168.105.160:/home/gituser/project.git
git push origin master
###########CLONE USER CREATE################
#Jerry
git clone gitrepo@192.168.105.160:/home/gitrepo/project.git
Cloning into 'project'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
#MOVE Directory
prodject :mkdir src
#git mv README.file src/
########BACKUP AND RESTORE AT NEW MACHINE###########
If system is down we want to move GIT repo at other server
follow step
#Use daily latest backup repo
#Create USER AT SERVER MACHINE
#useradd raju
#passwd raju
#cope backup file like -- project.git
#Jerry user:- ssh-copy-id -i ~/.ssh/id_rsa.pub raju@192.168.105.161
#cd jerry_repo
[jerry@node2 jerry_repo]$ git remote add new-origin raju@192.168.105.161:/home/raju/project.git
git remote add new-origin gitrepo@192.168.105.161:/home/gitrepo/project.git
jerry@node2 jerry_repo]$ git push --all new-origin
jerry@node2 jerry_repo]$ git remote rm origin
[jerry@node2 jerry_repo]$ git remote rename new-origin origin
#add to repo server
---------------------------------------------------------------------------
git remote add new-origin raju@192.168.105.161:/home/raju/project.git
git push --all new-origin
#git pull origin master
git push --all new-origin
git branch -a
cd project/
git branch -a
git remote rm origin
git remote rename new-origin origin
git push origin master
https://www.smashingmagazine.com/2014/05/moving-git-repository-new-server/
take backup git repo
#check permission with same user name and group
#add remote machine
#pull master
#remove origin
No comments:
Post a Comment