GIT setup

Revision as of 07:48, 19 November 2018 by WikiFreak (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This was done on Ubuntu 16.04. It must be reviewed!


Installation

apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
apt-get install git git-doc git-gui


If you want to use GIT as your local SVN client:

apt-get install git-svn


If you want to browse the GIT repository in a local browser:

apt-get install gitweb


Configuration

Run the following commands a standard user, not root!

GLOBAL configuration

To apply settings for *every* projects:

git config --global user.name "guillaume.diaz"
git config --global user.email johndoe@example.com
git config --global core.editor vim


Repository configuration

To apply settings for particular repository (recommended)


By doing so your credentials will never be asked again.


############
# Declare your identity
############
# Go at the root of your GIT repo (= your local clone)
git config user.name "guihome-diaz"
git config user.email "myemail@mydomain.com"


############
# Save credentials
############
# settings will be saved in ~/.git-credentials
$ git config credential.helper store

# adjust for each repostiory
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>


source: https://git-scm.com/docs/git-credential-store


Register SSH key

If you'd like to register a SSH key to use with GIT, see the excellent GitHub documentation: https://help.github.com/articles/generating-ssh-keys/



Ignore files in GIT

For a complete list of files see: https://github.com/github/gitignore

Here is my .gitignore file.


Create a file called .gitignore to the root of your GIT repo.

cd [my GIT repo]
vim .gitignore


Insert the following code:

/target/
/.classpath
/.project
/bin/
/.settings/
/.checkstyle
/temp/
/tmp/
/node_modules/
/infinitest.filters

# ******* NODE GIT IGNORE rules from GitHub (https://github.com/github/gitignore/blob/master/Node.gitignore)
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/



# ***** JAVA GIT IGNORE from GitHub (https://github.com/github/gitignore/blob/master/Java.gitignore)
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar


# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


# See http://help.github.com/ignore-files/ for more about ignoring files.
# ----------------------------------------------------------

# Java binaries
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp

# Package Files
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
**/hs_err_pid*

# Source control
**/.svn
**/.git

# compiled output
**/dist
**/tmp
**/out-tsc
**/out
**/bin
**/build
**/target
**/.gradle

# Dependencies and Java-Script
**/node_modules
**/bower_components
**/node
**/npm-debug.log
**/dependencies

# IDEs and editors
**/.idea
**/.project
**/.classpath
**/.checkstyle
**/.c9
**/.settings/
*.sublime-workspace
.factorypath
.springBeans

# Project launch configuration
# (i) sometimes you want to keep it! 
#     Just remove the ones at the root, these are the ones automatically generated
*.launch

# Swagger
**/.swagger-codegen-ignore

# IDE - VSCode
.vscode/*
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

# misc
**/*.log
**/.sass-cache
**/connect.lock
**/coverage
**/libpeerconnection.log
**/npm-debug.log
**/testem.log
**/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
thumbs.db

# Windows applications
*.exe 
*.dll
*.msi* 

# Other languages
*.o 
*.lo 
*.la 
#*# 
.*.rej 
*.rej
*.class 
*.mine 
*.obj 
*.ncb 
*.lib 
*.log 
*.idb 
*.pdb 
*.ilk 
*.res 
*.pch 
*.suo 
*.exp 
release 
Release 
debug 
Debug
ignore 
Ignore 
bin 
Bin 
obj  
Obj
*.csproj.user 
*.user
*.generated.cs


# Linux swap files
*.*~ 
*.~* 
~*.*
.*~ 
*~ 
.#* 
*.bak 

# CVS files
cvs  
CVS 
.CVS 
.cvs  

# EmberJS (misc)
**/.sass-cache
**/connect.lock
**/coverage/*
**/libpeerconnection.log
**/testem.log

# Other garbage files
.apt_generated/


You can find more example on https://github.com/github/gitignore