Need Advice? CALL: +61 417949565

Riksi - web design and development

  • Home
  • ABOUT US
  • OUR WORK
  • BLOG
  • CONTACT US
  • Home
  • BLOG
  • General
  • Complete Guide to setup remote Git on your site

Complete Guide to setup remote Git on your site

Complete Guide to setup remote Git on your site

In order to use git

  • Check git version
    • Command: git -version
  • If not install, add it to your server (Centos)
    • sudo yum install git-all
  • Create local Repository:
    • Command: git init
  • Add all file to your local git
    • command: git add -u *
  • Commit them to your local repository
    • command git commit <file> -m “some comment”
  • Check the status of your git:
    • command: git status
  • Check all logs
    • command: git log
  • Check diff
    • command:git diff <file name>
  • Check your branch:
    • command: git branch
  • Create Gitlab account and then create new project.
  • Create  key to connect to ssh (on your server
    • ssh-keygen -t rsa  -C “[email protected]”
  • Add ssh key to your server (Ensure the ssh-agent is running)
    • command: eval(ssh-agent -s) or eval ssh-agent -s – This execute bash script, you need re-run everytime server restarted
  • Add your SSH key to the ssh-agent
    • Command: ssh-add id_rsa (full path: ssh-add /root/.ssh/id_rsa)
  • Check if ssh added fully (should return 0)
    • Command: ssh-add -l
  • Copy the value of public key
    • command: cat /root/.ssh/id_rsa.pub
  • On gitlab, select your project, click setting and click deploy key then paste the value of your public key
  • Copy ssh link of your project.
  • Add remote project to your server
    • command:git remote add remoteName project_ssh_link (without ssh)
  • If you added wrongly, update site url
    • command: git remote set-url remoteName  /the/correct/url
  • Check all remote links:
    • command: git remote -v
  • Push to your remote
    • Command: git push -u remoteName  master
  • Get latest changes from remote:
    • Command: git fetch remoteName
  • Get latest changes from remote and merge:
    • Command: git pull remoteName
  • Remove remote git on server
    • Command: git remote rm destination

 

Some more tips

Add your file to .gitignore if you dont want to git index them

If the agent has no identities after adding key add key again

chmod for id_rs key should be 600

Increase the Git buffer size to the largest individual file size (for upload via http):
git config –global http.postBuffer 157286400 (for 1.5 GB)

check remote branches:
git branch -r

move to remote branches:
git checkout –track origin/branch

shorthand for:
git checkout -b [branch] [remotename]/[branch]

Tagged under: git
Nick
Wednesday, 22 February 2017 / Published in General, PHP, Security, Wordpress

What you can read next

Magento & WordPress Password Online Hash Generator
Add Password Protection to any Folder with .htaccess file
WordPress on multi-environment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archive

  • General
    • Smart Home
  • Web developing
    • command line
    • CSS
    • General
    • git
    • Javascript
    • Laravel
    • Magento
    • MySQL
    • PHP
    • Security
    • Shopify
    • Wordpress

Recent Posts

  • Install HomeAssistant on Raspberry pi

  • Shopify ERR_INVALID_ARG_TYPE Error

Riksi

Riksi is a creative, professional & cutting-edge custom web design and development company.

HERE TO HELP

  • BLOG
  • Contact Us
  • Our Work
  • About Us

New on Blog

  • Install HomeAssistant on Raspberry pi

    To install it, We need to connect the SD card t...
  • Shopify ERR_INVALID_ARG_TYPE Error

    fix the Internal Server Error occurred while in...

GET IN TOUCH

T: (+61) 417 949 565
Email: [email protected]

Contact Us
Fill out the form and our team will be in touch with you promptly. Thank you for your interest!

AU & NZ
T: (+613) 9014 9495
T: (+61) 417 949 565
Email: [email protected]


US & Canada
Email: [email protected]

NAME

EMAIL

PROJECT TYPE
PROJECT BUDGET

MESSAGE

Could not authenticate you.

Whats on Instagram

Loading...

Tags

.htaccess calculation cherry pick composer content css deployer documentation error flex general knowledge get started git git stash hack javascript log mysql package password php PHP Trick replace scss shopify sidebar ssh symlink sync trick ubuntu windows 10 wordpress trick wp
  • GET SOCIAL
Riksi - web design and development

© 2020 All rights reserved. Riksi.com.

TOP