Our lab uses gitlab.com to host most of the project source codes in private repositories. Here are very quick guides from without git knowledge. Note there is no difference in use of gitlab or github. You use the same software system, except you specify different repo in the url.
Install Git in Windows
- Create an account at gitlab.com if you haven’t.
- Install Git for Windows.
- Add user. See “Configure Git” in this webpage: https://docs.gitlab.com/ee/gitlab-basics/start-using-git.html.
- Add SSH key to your gitlab profile. Follow this guide: https://docs.gitlab.com/ee/ssh/.
- Now you can right click in any folder and select “Git Bash Here” to use git in this folder
Clone Project
- Go to the project page on gitlab.com.
- Click the blue “Clone” button.
- Copy the “Clone with SSH” link, e.g.
git@gitlab.com:ailabuser/example.git
. - Navigate to the root of your workspace folder in your computer. The cloned project will be a sub folder in here. This workspace can have your different projects in different sub-folders.
- Right click and select “Git Bash Here”.
- Enter
git clone
followed by the project SSH link, e.g.git clone git@gitlab.com:ailabuser/example.git
. - You should see the project being downloaded to your computer.
- May be helpful: https://stackoverflow.com/questions/30202642/how-can-i-clone-a-private-gitlab-repository
Useful References
- Workflow: https://rogerdudler.github.io/git-guide/
- Tutorial: https://www.git-scm.com/docs/gittutorial/1.8.2
- Each time you want to push your changes:
- Add new files to git:
git add filename
orgit add *
. - Commit changes to git:
git commit -m "Commit message"
. - Push changes to remote:
git push origin master
or simplygit push
if you are not working with branches.
- Add new files to git:
- Other useful commands:
- To check all branches local and remote:
git branch -a
. - To pull changes from remote:
git pull
.
- To check all branches local and remote:
- Below are the slides prepared by Amran:
[gview file=”https://ailab.space/wp-content/uploads/quick-git-info/Git_101.pdf”]