- Continuous Integration,Delivery,and Deployment
- Sander Rossel
- 613字
- 2021-07-02 15:42:12
Using Git
Installing Git on Windows is easy enough. Simply head over to their website (https://git-scm.com/) and download the Windows installer. Run it and leave all the defaults. This will also install the Git GUI and the Git Bash.
Open up a Command Prompt. First, we need to identify ourselves to Git. Git has settings on three different levels, system, global, and local. The system settings are system-wide and apply to all Git repositories on the computer. The global settings apply to all the repositories for the currently logged in user. The local settings apply to a single Git repository. More specific settings override less specific settings, so system settings can be overridden by global and local settings, and global settings can be overridden by local settings. To identify ourselves, we are going to set the global settings user.name and user.email. After that, we can clone our Git repository (meaning we are copying it to our computer):
git config --global user.name "Your Name"
git config --global user.email "your.email@provider.com"
git clone http://ciserver/user/test.git desktop\myrepo
The link to your Git project can be found on the project page of GitLab. The desktop/myrepo part is optional and specifies a custom folder for your project. The default folder is the name of the Git repository in your current folder. Add a file to the folder Git just created. A simple text file will do. Now move to your repository with cd desktop\myrepo (or whatever folder you cloned to). The next thing we need to do is add the new text file to the repository; you can do this with git add . (the . means we are just adding all the files). You can now check out the status of your repository using git status. You will see that the text file needs to be committed. We can commit our changes using git commit -m "Some commit message". Because Git creates a local repository, we still need to push to commit to the server. We can do this using git push:
cd desktop\myrepo
git add .
git status
git commit -m "Added a text file."
git push
Here is output of the preceding commands:

Now, if you go back to GitLab, you should see your commit. If everything worked, you have successfully installed Git and GitLab!
Working from the command line is doable, but not very practical. Especially when you have got a big project with many files. When you use GitHub, you can use their GitHub Desktop. When you decided to go for BitBucket, you are probably using SourceTree. Well, Git has the Git Gui. With Git Gui, it is a lot easier to see which files need to be added, are changed, will be committed, and so on. When you open it, you can create, clone, or open a repository. Go for Clone Existing Repository, enter the repository URL and a non-existent folder, and the repository will be cloned to your computer:

The next window will show you your changes. When you make some changes to your text file, add another text file, and hit Rescan, you will see the files in the upper-left corner. You can click the icons to add or stage the files, after which you can commit and push:

- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- PHP 7底層設(shè)計與源碼實現(xiàn)
- 青少年美育趣味課堂:XMind思維導(dǎo)圖制作
- Mastering macOS Programming
- 區(qū)塊鏈技術(shù)與應(yīng)用
- jQuery炫酷應(yīng)用實例集錦
- C++20高級編程
- Mastering C++ Multithreading
- Emgu CV Essentials
- 大話Java:程序設(shè)計從入門到精通
- SEO教程:搜索引擎優(yōu)化入門與進階(第3版)
- iOS Development with Xamarin Cookbook
- Practical Linux Security Cookbook
- 計算機信息技術(shù)實踐教程
- Learning Behavior:driven Development with JavaScript