Posts

Showing posts with the label Git

Git post receive setup at server for git push to the production from local machine

IN SERVER cd www mkdir repo cd repo mkdir app.website.git cd app.website.git git init –bare cd hooks touch post-receive chmod R 775 post-receive put the following line in post-receive file git --work-tree=/var/www/html/app.website.com --git-dir=/var/www/repo/app.website.git checkout master -f cd /var/www/html/app.website.com nano /etc/hosts 127.0.1.1 app.website.com cd /etc /apach2 /site-available cp 000-deault.conf app.website.com.conf LOCALLY git remote -v git remote add prod-website ssh://root@192.168.0.1:/var/www/repo/app.website.git

Delete a local and a remote GIT branch

Delete a local GIT branch - git branch -d branch_name - git branch -D branch_name Delete a remote GIT branch - git push <remote_name> --delete <branch_name>

Rename a local and remote branch in git

If you have named a branch incorrectly AND pushed this to the remote repository follow these steps before any other developers get a chance to jump on you and give you shit for not correctly following naming conventions. 1. Rename your local branch. If you are on the branch you want to rename: > git branch -m new-name If you are on a different branch: > git branch -m old-name new-nam e 2. Delete the old-name remote branch and push the new-name local branch. > git push origin :old-name new-name 3. Reset the upstream branch for the new-name local branch. Switch to the branch and then: > git push origin -u new-name

Git remote URL information details by terminal command

1. Only the URL that a local Git repository was originally cloned from. git config --get remote.origin.url 2. Remote Information Details git remote show origin

Git credentials storing in cache

Windows git config --global credential.helper wincred git pull origin <enter your branch> Username: <type your username> Password: <type your password> Ubuntu git config credential.helper store git pull origin <enter your branch> Username: <type your username> Password: <type your password> Fedora git config --global credential.helper gnome-keyring git pull origin <enter your branch> Username: <type your username> Password: <type your password>

Git configuration related essential command

Set user email and name after removing previous all :   git config --global --replace-all user.email "new@mail.com" git config --global --replace-all user.name "newname" Set user email and name :  git config --global --user.name "setname" git config --global --user.email "set@mail.com" Show current user email and name :  git config --global --user.name git config --global --user.email

MySQL table creation command

CREATE TABLE `std`(`id` int(11) NOT NULL AUTO_INCREMENT,`name` VARCHAR(20) DEFAULT NULL, PRIMARY KEY(`id`));

Process to view repository project on live in github

-> Create a repository name as your wish -> Upload all files to the repository from your project folder -> Go to the branches and add a branch name gh-pages for this repository -> Your job has done -> Now go through the link such as http://username.github.io/repositoryname

The process of hosting a site in github with (https://username.github.io) URL

Step by step is written below, -> Create a repository name as username.github.io -> git clone https://github.com/username/username.github.io -> cd username.github.io -> Copy your project files into the username.github.io folder -> git status -> git add --a -> git commit -m "Uploading Files" -> git push -u origin master