Here is some basic procedures that one can build your repositories:
- Making a local "non-bare" working repository, add a folder and files inside under git version control:
- We start from mkdir an empty folder mkdir wire
- And then copy the files to wire
- Add all the files inside folder 'wire', and git commit them all
- Edit git comment to provide some information about the version and descripiton comment. And also you can add user name and email information about it:
git config --global user.name "Voornaam Achternaam"
git config --global user.email "aaa@bbb.com"
git config --global core.editor "my favorate editor" #e.g. vim, nano, less
cd wire
git init
git add *
git commit -a
# Note, it is very important not to include .pyc, .py~ files otherwise your will get much unnecessary and unexpected trouble in the future
- Make a bare repository, a remote copy of your local working reposiotry:
- making a remote bare repository using ssh to our server:
ssh name@ssh.lorentz.leidenuniv.nl
mkdir repo/wire.git
cd repo/wire.git
git init --bare
exit
- Go back to your local working repository, and make remote add, and push your local repository to the remote bare repository wire.git at the server:
- Note here "
origin" is a name you can choose for the remote bare repository, you can name it for whatever you want, and you can check the all the remote repositories name or choose to delete them by using the command below
git remote # check all the name of remote repository - After your git push from you local non-bare repository to the bare repository, you can go to your server and using "gitk --all" (if you have that) to check out the status, or using "git status". You can always use these command to check the status and branch.
git remote addoriginname@ssh.lorentz.leidenuniv.nl:repo/wire.git
git pushoriginmaster
git remote rm aaa # remove the remote repository whose name is aaa
- making a remote bare repository using ssh to our server:
ssh name@ssh.lorentz.leidenuniv.nl
- Get a copy of a remote bare repository:
- If it is from your own computer or server account
- If it is from other computer or server account
git clone /repo/wire.git
git clone name:ssh.lorent.leidenuniv.nl:repo/wire.git
git clone ~/otheruser/repo/hie_or_her_project.git
git clone name:ssh.lorent.leidenuniv.nl:~otheruser/repo/his_or_her_project.git
Note, unless you want to make some change in this repository (but usually people do not make change here), do not first make this folder 'git init'. Here you just copy or fetch it from a remote repository. You will always working and make file changes in you local non-bare working repository, i.e. wire here, and then push the changed files to ~repo/wire.git. You will always keep up changes from wire.git by using 'git fetch'. Make sure you understand this information flow direction once you made some change. - Keep up with changes from remote repositories:
- Once you make some change in your local non-bare working repository, you git push it to the bare repository, and to keep up the change at other places from this non-repository you need to: git fetch
- In order to make sure you have the same version, you go to your copied repository and check
git reset --hard
Or you can delete the folder and make git clone, see above section
git describe --always
This will return a series number which identify the version of your repository, which is made after each time you made change in your working repository and git commit them. Each version has a unique version series number. So this number here should be coincides with the same number you using 'git describe --always' at your local non-bare working repository.
No comments:
Post a Comment