Tikejhya: Ashish Nepal

Knowledgebase

Category: GIT

git basics

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

# Install git server
yum install git

# Lets use user called git [specify home directory and group if required]
useradd git

# Into users home directory
cd /home/git/

# Initiate bare repo
git init --bare --shared

################################

GIT Revert back to a previous commit/s

#Find the git commit code you want to revert back to
git log

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

commit bed35e87a07ae81f795598acfde163acb184211c
Author: root 
Date:   Mon Jun 6 12:08:19 2012 +0100

# Now reset
git reset bed35e87a07ae81f795598acfde163acb184211c

# Now move pointer to previous HEAD
git reset --soft HEAD@{1}

# Commit the changes
git commit -m "reverted to bed35e87a07ae81f795598acfde163acb184211c"

#Update working copy, this reflects new commit
git reset --hard

………

# Push changes
git push origin master

Above method is good if you want to jump back to any previous commit, however to jump back to immediate commit, you can

git reset --hard HEAD

Share Git Repository with HTTPS

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Configuring Apache HTTPS In order to share your repository
Share GIT Repository with HTTPS.

# git.ashishnepal.net

        ServerAdmin admin@ashishnepal.com
        ServerName git.ashishnepal.net

        DocumentRoot /var/version_control/git_repository
        DAVLockDB /var/version_control/git_repository/DAVLockDB
        ErrorLog /var/logs/www/git/ssl_error_log
        CustomLog /var/logs/www/git/ssl_access_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

        SSLEngine On
        SSLProtocol -ALL +SSLv3 +TLSv1
        SSLCipherSuite ALL:-ADH:!kEDH:!EXPORT:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
        SSLCertificateFile /etc/httpd/conf/certs/wildcard.ashishnepal.net.crt
        SSLCertificateKeyFile /etc/httpd/conf/certs/wildcard.ashishnepal.net.key.nopass
        SSLCertificateChainFile /etc/httpd/conf/certs/gd_bundle-2011.crt
        SetEnvIf User-Agent ".*MSIE.*" 
                nokeepalive ssl-unclean-shutdown 
                downgrade-1.0 force-response-1.0

        
                DAV on
                Options ExecCGI FollowSymLinks Indexes
                # Deny everyything here
                AuthType Basic
                AuthName "git repository"
                AuthUserFile /var/version_control/git_repository/git_access
                AuthGroupFile /var/version_control/git_repository/htgroup.git
        


        Allow from all
        Order allow,deny
        
                Require group project-read
        
        
                Require group project-write
        

How-to-Install-git with https support on centos
installing-git-with-https-in-centos

Installing GIT with HTTPS in Centos

Install git with Yum

yum install git-core
cd /path/to/repo
mkdir newProject
cd newProject

git --bare init

chown -R apache:apache /path/to/repo
cd /path/torepo/newProject/hooks
mv /path/torepo/newProject/hooks/post-update.sample /path/torepo/newProject/hooks/post-update
Enable the post-update hook: chmod +x /path/torepo/newProject/hooks/post-update

cd /path/to/repo/newProject
git update-server-info

Now you must ensure Your permision i would again run

chown -R apache:apache /path/to/repo

Otherwise you would get error such as, curl=22 HTTP 401, 403,
this could also be due to permission issue ensure, Ur username and password,

Last but the most importantly see your log file which always provides best information.

Log: Apache log for git.

How to configure Apache config file.

Powered by WordPress & Theme by Anders Norén