GIT TUTORIAL by David Raleche

 

Upgrade GIT to version : git version 1.7.10.2
NOT RECOMMENDED - too old : git version 1.5

 

UPGRADE GIT
#1 -
  rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

#2 - yum install --enablerepo=webtatic git-all

 

 

RECOMMENDED WEBSITE -  www.gitref.org

RECOMMENDED WEBSITE - www.gitimmersion.com/lab_39.html

http://www.gitguys.com/topics/creating-a-shared-repository-users-sharing...
 GIT doesn't have a central server like Subversion.

-------------------------------------------------------------------------------------------------------------------------------

New Project Git Setup

git init

git init YOURPOJECT.git --bare

git clone /var/www/YOURPROJECT.git  THEFOLDER
(problem . do not clone folder not empty)

gid add *.php

git commit -a

CONFIGURE REMOTELY GIT

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedRepository = group
[remote "origin"]
        url = /vol/www/aptnewyork.git
        fetch = +refs/heads/*:refs/remotes/master/*
        fetch = +refs/heads/*:refs/remotes/david/*
        merge = +refs/heads/*:refs/remotes/david/*
        merge = +refs/heads/*:refs/remotes/master/*
 

 

UPDATE GIT FOLDER AUTOMATICALLY
emacs hooks/post-update

#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
 
#exec git update-server-info
 
GIT_WORK_TREE=/var/www/yourproject git reset --hard
GIT_WORK_TREE=/var/www/yourproject git pull /var/www/YOURPROJECT.git master
 

Basic Everyday Command 

git status -s

LIST BRANCHES

 

$ git branch

 

CREATE NEW BRANCH

	$ git branch david

SWITCH BRANCH

 

$ git checkout david

 

MERGE BRANCH

$ git merge master

 

REMOTE

$  git remote add david xxxxxxx.com:/var/www/git-test
FREE WINDOWS CLIENT GIT - SMARTGIT

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FETCH
$git fetch
$fatal: 'origin': unable to chdir or not a git archive
$fatal: The remote end hung up unexpectedly
 
IF YOU HAVE THIS ERROR WHEN DOING GIT INIT --BARE
usage: git-init [-q | --quiet] [--template=<template-directory>] [--shared]
 
DO THE FOLLOWING
# Add the repository
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

# Install the latest version of git
yum install --enablerepo=webtatic git-all

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

TO BE CONTINUE

http://www.gitguys.com/topics/creating-a-shared-repository-users-sharing...

 

 

git init --bare project1.git

 

-- git clone file:///var/www/git-test/project1.git git-implement

HOW TO SOLVE THIS ISSUE

 

error: insufficient permission for adding an object to repository database ./objects
 
SOLUTION
git config core.sharedRepository group

ALSO
Make sure all folder are the rights and same users right writing

 

 

 

She is shown there is only one remote repository named origin. The default remote repository when you git clone a repository is named origin, so the above output isn’t surprising.

Configure for Live website Update

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

PROBLEM
error: Your local changes to the following files would be overwritten by merge:
SOLUTION

git reset --hard HEAD
git pull

 

 

PROBLEM
error: Your local changes to the following files would be overwritten by merge:

SOLUTION

 

git fetch --all
git reset --hard origin/master

Latest Post

Popular Post

Our Skills

Author

Project Director Information Architect Database Administrator Unix Administrator Senior Developer Project Manager Product Manager Web Marketer Cloud Engineer

Contact Us

For any questions or project ideas please contact me at the following.

I'm here