GIT
Git versioning
Initialize new repository :
cd /var/git mkdir project.git cd project.git git init --bare
Push to remote repository :
cd myproject git init git add . git commit -m 'initial commit' git remote add origin git@gitserver:/opt/git/project.git git push origin master
Change config
In case your remote repository isn't bare, you cannot to it with the following error:
PS C:\Users\julien.andonov\OracleScripts> git push origin master Enter passphrase for key '/c/Users/julien.andonov/.ssh/id_rsa': Counting objects: 3244, done. Delta compression using up to 4 threads. Compressing objects: 100% (3097/3097), done. Writing objects: 100% (3244/3244), 665.81 MiB | 732.00 KiB/s, done. Total 3244 (delta 556), reused 0 (delta 0) remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. To remote_repo_ip:/home/git/OraScripts ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to 'git@repo_ip:/home/git/OraScripts' PS C:\path\OracleScripts>
In order to fix that, you have to change the specification and delete all directories except for the “.git”:
git@dokuwiki OraScripts]$ git rev-parse --is-bare-repository false [git@dokuwiki OraScripts]$ git config --bool core.bare true [git@dokuwiki OraScripts]$ git rev-parse --is-bare-repository true [git@dokuwiki OraScripts]$ rm -rf refs/ [git@dokuwiki OraScripts]$ rm -rf info/ [git@dokuwiki OraScripts]$ rm -rf hooks/ [git@dokuwiki OraScripts]$ rm -rf HEAD [git@dokuwiki OraScripts]$ rm -rf description [git@dokuwiki OraScripts]$ rm -rf branches/ [git@dokuwiki OraScripts]$ rm -rf config [git@dokuwiki OraScripts]$ rm -rf objects/ [git@dokuwiki OraScripts]$ ls -lart total 12 drwx------. 10 git git 4096 Jun 8 11:54 .. drwxrwxr-x. 7 git git 4096 Jun 8 12:52 .git drwxrwxr-x. 3 git git 4096 Jun 8 12:52 . [git@dokuwiki OraScripts]$ cd .git/ [git@dokuwiki .git]$ ls -lart
After this, try to upload it again:
PS C:\path\OracleScripts> git push origin master Enter passphrase for key '/c/path/.ssh/id_rsa': Counting objects: 3244, done. Delta compression using up to 4 threads. Compressing objects: 100% (3097/3097), done. Writing objects: 100% (3244/3244), 642.59 MiB | 729.00 KiB/s, done. Total 3244 (delta 557), reused 0 (delta 0) To remote_repo_ip:/home/git/OraScripts * [new branch] master -> master PS C:\path\OracleScripts>
You can test if everything is normal, by cloning the repository somewhere else:
PS C:\Users\julien.andonov> mkdir OracleScripts2 Directory: C:\Users\julien.andonov Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 08/06/2018 15:11 OracleScripts2 PS C:\path> cd .\OracleScripts2\ PS C:\path\OracleScripts2> dir PS C:\path\OracleScripts2> git clone git@repo_ip:/home/git/OraScripts/.g it Cloning into 'OraScripts'... Enter passphrase for key '/c/path/.ssh/id_rsa': remote: Counting objects: 3244, done. remote: Compressing objects: 100% (2541/2541), done. remote: Total 3244 (delta 556), reused 3244 (delta 556) Receiving objects: 100% (3244/3244), 665.81 MiB | 7.93 MiB/s, done. Resolving deltas: 100% (556/556), done. Checking out files: 100% (9580/9580), done. PS C:\path\OracleScripts2> dir Directory: C:\Users\julien.andonov\OracleScripts2 Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 08/06/2018 15:16 OraScripts PS C:\path\OracleScripts2> cd .\OraScripts\ PS C:\path\OracleScripts2\OraScripts> dir Directory: C:\path\OraScripts Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 08/06/2018 15:14 Cassandra d----- 08/06/2018 15:16 hooks d----- 08/06/2018 15:14 IBM d----- 08/06/2018 15:16 info d----- 08/06/2018 15:14 MongoDB d----- 08/06/2018 15:14 MySQL d----- 08/06/2018 15:14 Notepad d----- 08/06/2018 15:14 Oracle_Scripts_Archive d----- 08/06/2018 15:16 Personal d----- 08/06/2018 15:16 PostegreSQL d----- 08/06/2018 15:14 PTL d----- 08/06/2018 15:16 SQL Server d----- 08/06/2018 15:16 Tain -a---- 08/06/2018 15:16 110 config -a---- 08/06/2018 15:16 74 description -a---- 08/06/2018 15:14 24 HEAD
Git update
Once you make a changes to files in GIT or you create empty files, you have to update/upload the new files. So in order to get the information about which files are new and have to be added, use the following:
Get status
C:\OracleScripts>git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: ELK Stack/ELKStack.conf new file: ELK Stack/Logstash.conf Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: MySQL/StorageMngm.txt modified: SQL Server/LogShipping.txt modified: Tain/TainProcedures.txt Untracked files: (use "git add <file>..." to include in what will be committed) SQL Server/Space_Management.txt C:\OracleScripts>
This shows that file 3 files are changed: MySQL/StorageMngm.txt, SQL Server/LogShipping.txt and Tain/TainProcedures.txt, and also 1 file is new: SQL Server/Space_Management.txt.
In order add the new file to the repo, use the following command:
Add new File
C:\OracleScripts>git add "SQL Server" C:\OracleScripts>git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: ELK Stack/ELKStack.conf new file: ELK Stack/Logstash.conf modified: SQL Server/LogShipping.txt new file: SQL Server/Space_Management.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: MySQL/StorageMngm.txt modified: Tain/TainProcedures.txt
Once all is done, we can commit our records (with a comment: “Update 12/06/2018”) as follows:
Commit & Upload to Master
C:\OracleScripts>git commit -a -m "Update 12/06/2018" C:\OracleScripts>git push origin master Enter passphrase for key '/c/Users/julien.andonov/.ssh/id_rsa': Counting objects: 12, done. Delta compression using up to 4 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (12/12), 6.18 KiB | 1.03 MiB/s, done. Total 12 (delta 5), reused 0 (delta 0) To 35.195.48.235:/home/git/OraScripts fb30034..2067bcc master -> master C:\OracleScripts>
MAVEN
Add JAR to local repository :
mvn install:install-file -Dfile=db2jcc4.jar -DgroupId=com.ibm -DartifactId=db2jcc4 -Dversion=10.5.0.5 -Dpackaging=jar
Tomcat server.xml JDBC pool :
<Resource name="jdbc/DBATOOLS" global="jdbc/DBATOOLS" auth="Container" type="javax.sql.DataSource" driverClassName="com.ibm.db2.jcc.DB2Driver " url="jdbc:db2://dbatoolsdev:60004/DBATOOLS" username="dbatools" password="<password>" maxActive="100" maxIdle="20" minIdle="5" maxWait="10000"/>