|
|
(One intermediate revision by the same user not shown) |
Line 26: |
Line 26: |
| | | |
| See | | See |
− | | + | * [[GIT client (basic)| GIT client (basic usage)]] |
− | [[GIT client (EP)|GIT client European Parliament]] | + | * [[GIT client (EP)|GIT client European Parliament]] |
− | | |
− | | |
− | =Installation=
| |
− | | |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
| |
− | apt-get install git git-doc git-gui
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | If you want to use GIT as your local SVN client:
| |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install git-svn
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | If you want to browse the GIT repository in a local browser:
| |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install gitweb
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | | |
− | =Configuration=
| |
− | | |
− | Run the following commands a '''standard user''', not root!
| |
− | | |
− | ==GLOBAL configuration==
| |
− | | |
− | To apply settings for *every* projects:
| |
− | | |
− | <syntaxhighlight lang="bash">
| |
− | git config --global user.name "guillaume.diaz"
| |
− | git config --global user.email johndoe@example.com
| |
− | git config --global core.editor vim
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | ==Repository configuration==
| |
− | | |
− | To apply settings for particular repository (recommended)
| |
− | | |
− | | |
− | By doing so your credentials will never be asked again.
| |
− | | |
− | | |
− | <syntaxhighlight lang="bash">
| |
− | | |
− | ############
| |
− | # 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>
| |
− | </synataxhighlight>
| |
− | | |
− | | |
− | 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/
| |
− | | |
− | | |
− | | |
− | =Get project files=
| |
− | | |
− | Run the following commands a '''standard user''', not root!
| |
− | | |
− | | |
− | * Clone an existing project
| |
− | <syntaxhighlight lang="bash">
| |
− | git clone [url] [targetFolder]
| |
− | </syntaxhighlight>
| |
− | | |
− | Note that you can use HTTPS, SSH or SVN URLs.
| |
− | | |
− | | |
− | | |
− | * Perform operation using Git GUI | |
− | <syntaxhighlight lang="bash">
| |
− | cd [my GIT repo]
| |
− | git gui
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | | |
− | =Update files=
| |
− | | |
− | * Check files status
| |
− | <syntaxhighlight lang="bash">
| |
− | git status
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | * Update files on local HEAD
| |
− | <syntaxhighlight lang="bash">
| |
− | git pull
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | | |
− | =Commit files=
| |
− | | |
− | * Add file
| |
− | <syntaxhighlight lang="bash">
| |
− | git add [file]
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | * Commit
| |
− | <syntaxhighlight lang="bash">
| |
− | git commit -m "my comment"
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | * Send changes to the server
| |
− | <syntaxhighlight lang="bash">
| |
− | git push
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | | |
− | =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.
| |
− | | |
− | <syntaxhighlight lang="bash">
| |
− | cd [my GIT repo]
| |
− | vim .gitignore
| |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | Insert the following code:
| |
− | | |
− | <syntaxhighlight lang="bash">
| |
− | ## generic files to ignore
| |
− | *~
| |
− | *.lock
| |
− | *.DS_Store
| |
− | *.swp
| |
− | *.out
| |
− | *.tmp
| |
− | *.temp
| |
− | build/
| |
− | | |
− | #java specific
| |
− | *.class
| |
− | target/
| |
− | | |
− | #maven
| |
− | pom.xml.tag
| |
− | pom.xml.releaseBackup
| |
− | pom.xml.versionsBackup
| |
− | pom.xml.next
| |
− | release.properties
| |
− | | |
− | #netbeans ignore personal stuff
| |
− | nbproject/private/
| |
− | | |
− | #eclipse specifics
| |
− | settings/
| |
− | .project
| |
− | .classpath
| |
− | .checkstyle
| |
− | | |
− | #intelliJ
| |
− | .idea/
| |
− | | |
− | #gradle
| |
− | .gradle/
| |
− | gradle-app.setting
| |
− | | |
− | </syntaxhighlight>
| |
− | | |
− | | |
− | You can find more example on https://github.com/github/gitignore
| |