Thứ Năm, 12 tháng 6, 2014

// // Leave a Comment

Upload public_html to repo on server & clone repo from client (not local)

Dong bo public_html vao repo
-----------------TAo 1 repo----------------------
thehai@thehai-Vostro-3550:~$ cd /var/cache/git/
thehai@thehai-Vostro-3550:/var/cache/git$ sudo mkdir wptheme
thehai@thehai-Vostro-3550:/var/cache/git$ cd wptheme/
thehai@thehai-Vostro-3550:/var/cache/git/wptheme$ sudo git --bare init
Initialized empty Git repository in /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:/var/cache/git/wptheme$ ls
branches  config  description  HEAD  hooks  info  objects  refs
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chown -R root:www-data /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chmod -R g+w /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo useradd -m hai
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo passwd hai
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo apt-get install gitweb
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ ls /usr/share/gitweb/
gitweb.cgi  index.cgi  static
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo nano /etc/apache2/conf.d/gitweb
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo a2enmod rewrite
Module rewrite already enabled
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chown -R root:www-data /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chmod -R g+w /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo nano /etc/apache2/sites-available/git
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo a2ensite git
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo service apache2 restart
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo htpasswd -c /var/cache/git/htpasswd.git hai
New password:
Re-type new password:
Adding password for user hai
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo nano /var/cache/git/htpasswd.git
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo nano /var/cache/git/htgroup.git
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo htpasswd /var/cache/git/htpasswd.git tuyet
New password:
Re-type new password:
Adding password for user tuyet
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo useradd -m tuyet
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo passwd tuyet
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chown -R tuyet:www-data /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chmod -R 770 /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ sudo chown -R hai:www-data /var/cache/git/wptheme/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ more /var/cache/git/htpasswd.git
hai:$apr1$ya0Jf1xm$6FfcMpoVxuFLLPW/oeZRv1
tuyet:$apr1$t3Uw3s7j$3Iief3T4WmXDAi97sgXne/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ ls
index.html
--------------------Bat dau clone---------------
thehai@thehai-Vostro-3550:/var/cache/git/wptheme$ cd ~/wptheme.com/public_html/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git init
Initialized empty Git repository in /home/thehai/wptheme.com/public_html/.git/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git remote add origin http://tuyet@git.localhost/wptheme.git/
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# index.html
nothing added to commit but untracked files present (use "git add" to track)
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git add index.html
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
# new file:   index.html
#
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git commit -a -m "trang chu first"
[master (root-commit) 63f290c] trang chu first
 1 file changed, 13 insertions(+)
 create mode 100644 index.html
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ git push origin master
Password for 'http://tuyet@git.localhost':
To http://tuyet@git.localhost/wptheme.git/
 * [new branch]      master -> master
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$
==============================
Client - nonlocal
thehai@thehai-Vostro-3550:~/wptheme.com/public_html$ cd ~/Desktop/
thehai@thehai-Vostro-3550:~/Desktop$ ls
Data~  haiquynh.co  test000003
thehai@thehai-Vostro-3550:~/Desktop$ git clone http://hai@git.localhost/wptheme.git/
Cloning into 'wptheme'...
Password for 'http://hai@git.localhost':
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
thehai@thehai-Vostro-3550:~/Desktop$ ls
Data~  haiquynh.co  test000003  wptheme
thehai@thehai-Vostro-3550:~/Desktop$ 

0 nhận xét:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.