Git standardno korištenje kod nas¶
1.a) Pokupi git repos sa remote lokacije (commit/push pristup)¶
napraviti ssh ključ
hernad@nmraka-1:~/devel/git$ ssh-keygen -t rsa
Generating public/private rsa key pair. Enter file in which to save the key (/home/hernad/.ssh/id_rsa): /home/hernad/.ssh/hernad@bring.out.ba Enter passphrase (empty for no passphrase): <<<<<<<<< bez ikakve lozinke da bi imao passwordless pristup Enter same passphrase again: Your identification has been saved in /home/hernad/.ssh/hernad@bring.out.ba. Your public key has been saved in /home/hernad/.ssh/hernad@bring.out.ba.pub. The key fingerprint is: d2:85:f8:5b:22:a8:5a:9c:b8:cc:6c:62:40:e0:93:67 hernad@nmraka-1
pa proslijediti git.bring.out.ba.pub administratoru da ga doda u gitosis/keypub
u ~/.ssh/config dodati
hernad@nmraka-1:~/devel/git/redmine-1.bring.out.ba/fin$ cat ~/.ssh/config | grep git
IdentityFile ~/.ssh/hernad@bring.out.ba
hernad@nmraka-1:~/devel/git$ cat /home/hernad/.ssh/hernad@bring.out.ba
-----BEGIN RSA PRIVATE KEY---- <<privatni ključ>> -----END RSA PRIVATE KEY-----
hernad@nmraka-1:~/devel/git$ cat /home/hernad/.ssh/hernad@bring.out.ba.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA<<javni ključ>>..4U31G1ebPJon5Q== hernad@bring.out.ba
hernad@nmraka-1:~/devel/git$ git clone git@git.bring.out.ba:kalk.git
Initialized empty Git repository in /home/hernad/devel/git/kalk/.git/ remote: Generating pack... remote: Done counting 3759 objects. remote: Deltifying 3759 objects... remote: 100% (3759/3759) done remote: Total 3759 (delta 2359), reused 0 (delta 0) Receiving objects: 100% (3759/3759), 808.40 KiB | 1365 KiB/s, done. Resolving deltas: 100% (2359/2359), done.
hernad@nmraka-1:~/devel/git/kalk$ ls
1g db integ Makefile proizvod rpt specif adm doc kalk.ch param razdb rtm template cdx dok mag primpak razoff si ut chs gendok main prod README.harbour sif vt
šta sam u stvari pokupio ?
hernad@nmraka-1:~/devel/git/kalk$ git branch -l
* harbour
koje još branch-ove imam na remote repos-u ?
hernad@nmraka-1:~/devel/git/kalk$ git branch -r
origin/HEAD origin/harbour origin/master
1.b) Pokupi udaljeni repozitorij (read-only pristup)¶
hernad@nmraka-1:~/devel/git$ git clone git://git.bring.out.ba/virm.git
Initialized empty Git repository in /home/hernad/devel/git/virm/.git/ remote: Generating pack... remote: Done counting 258 objects. remote: Deltifying 258 objects... remote: 100% (258/258) done remote: Total 258 (delta 105), reused 258 (delta 105) Receiving objects: 100% (258/258), 63.38 KiB, done. Resolving deltas: 100% (105/105), done.
2) Dodaj novi fajl u repos, pushiraj ga na git.bring.out.ba¶
napravio sam novi README fajl
hernad@nmraka-1:~/devel/git/fin$ git add README
commit u (lokalni repos):
hernad@nmraka-1:~/devel/git/fin$ git commit -m "init readme"
pushiraj - pošalji na git.bring.out.ba
hernad@nmraka-1:~/devel/git/fin$ git push
Counting objects: 4, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 296 bytes, done. Total 3 (delta 1), reused 0 (delta 0) refs/heads/harbour: 6796e5e88e853863788b508897ea3d6708d84e46 -> 333792bc1ff613405a80d4b1cf0f640138461f9b To git@git.bring.out.ba:fin.git 6796e5e..333792b harbour -> harbour
3) Podešenja git repos-a¶
setuj podatke o sebi, globalno za sve repozitorije:
$ git config --global core.autocrlf false <<<<<<<< git za windows-e $ git config --global user.name "Ernad Husremovic" $ git config --global user.email hernad@bring.out.ba $ git config --global core.editor vi
devel/fin$ git-config -l
gui.recentrepo=/home/hernad/devel/git/kalk user.name=Ernad Husremovic user.email=hernad@bring.out.ba core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.url=git@git.bring.out.ba:fin.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master gui.geometry=1001x469+139+296 207 192
.git/config
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@git.bring.out.ba:fin.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [gui] geometry = 1001x469+139+296 207 192
R) reference¶