Wednesday, 11 January 2017

Setup git on Linux

On Linux how to: Install and configure git, start controlling existing code, push to a cloud repository e.g. github.com



Install and Configure Github on Linux


The following commands should be run on the command line.

sudo yum install git-all or sudo apt-get install git-all

git config --global color.ui true
git config --global user.name "Kylie Minogue"
git config --global user.email "kylie@minogue.net"
git config --global core.editor nano

Start Controlling Existing Code

cd path/to/code/root
git init
touch .gitignore
nano .gitignore then add what you wish git to ignore e.g. .gitignore, node_modules, .*
git add .
git commit 

Push to Github

Create a repository on github.com then back in the Linux command line:
git remote add origin https://github.com/username/repoName.git
git push -u origin master

See my other blog posts on using Git including setting up a workflow with branches