Starting with Git and Github on ubuntu

github

1 – Install Git
sudo apt-get install git

2 – Create a github account on GITHUB

3 – configure your git on your linux
git config --global user.name "user_name" where user_name is your github login
git config --global user.email "email" where email is your email used on github

Before the next step I will propose you to see our post about using SSH beetwin git and github

Here is the post :GIT GITHUB and SSH

 

4 – Create a local repository
Create a folder in your system. This will serve as a local repository which will later be pushed onto the GitHub website.
Use the following command: git init devops_pm_rep

 

On github you can try to fork an existing project , for example

https://github.com/jjz109/jhipster_example

Connected you can clic on the fork button to add this project to your account

When your github account is ok , you can create a local clone on your computer by using git
On github, on the right you’ll find a https clone url field. Copy the link.
something like  : https://github.com/xxxxxxxx/jhipster_example.git
in a terminal:
git clone https://github.com/xxxxxxxx/jhipster_example.git where xxxxis your user-name
It should do:

Clonage dans 'jhipster_example'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
Vérification de la connectivité... fait.

You can now ask git to sync your clone with the original repository (orignal is not your fork but the project you forked)

copy the url to the original project. in the example :
https://github.com/jjz109/jhipster_example.git

in your terminal : go to the repository where you put your git clone

cd $home
ls
cd xxxxxx

when you find your .git
git remote -v will show your repositories

git remote add upstream https://github.com/jjz109/jhipster_example.git
wil add this upstream

Now, you can keep your fork synced with the upstream repository with a few Git commands
Sync a fork of a repository to keep it up-to-date with the upstream repository


git fetch upstream
# remote: Counting objects: 75, done.
# remote: Compressing objects: 100% (53/53), done.
# remote: Total 62 (delta 27), reused 44 (delta 9)
# Unpacking objects: 100% (62/62), done.
# From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
# * [new branch] master -> upstream/master

Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master

Check out your fork’s local master branch


$ git checkout master
# Switched to branch 'master'

Merge the changes from upstream/master into your local master branch. This brings your fork’s master branch into sync with the upstream repository, without losing your local changes.
$ git merge upstream/master

Syncing your fork only updates your local copy of the repository. To update your fork on GitHub, you must push your changes.

Pushing to a remote

Use git push to push your local branch to a remote repository.

The git push command takes two arguments:

A remote name, for example, origin
A branch name, for example, master

For example:

git push

As an example, you usually run git push origin master to push your local changes to your online repository.

 

ENJOY !

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

EASY DEPLOY on distelli.com ( FREE PLAN)

This example illustrate some steps to deploy on distelli.com  https://www.distelli.com/

I ve choosen a simple PHP app

First creat an account on distelli.com (a FREE PLAN account for :

  • 2 Servers
  • Unlimited Deployments
  • Unlimited Releases
  • Email Support

After sign in , you will be ask for a fisrt EASY DEPLOY experience

installing the client

curl -sSL https://www.distelli.com/download/cli/setup | sh

copying the app from git

git clone https://github.com/Distelli/PHPUbuntuPSimpleApp.git ~/distelli/sample_apps/PHPUbuntuPSimpleApp && sed -i.orig "s/<username>/xxxxxx/g" ~/distelli/sample_apps/PHPUbuntuPSimpleApp/distelli-manifest.yml && cd ~/distelli/sample_apps/PHPUbuntuPSimpleApp

where xxxxxx is your distelli username

installing the agent on your server

curl -sSL https://www.distelli.com/download/agent/install | sh

deploying the app

distelli deploy -m "My fisrt sample deployment" -e PHPUbuntuPSimpleAppEnv -y

 

After that you will be able to manage your server and app on distelli.com

showing : standard output of your server , …statuts, …


 

To stop the agent :

sudo -i

dagent stop

And logout from client :

distelli logout

TRY IT and ENJOY

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook