diff options
Diffstat (limited to 'doc/topics/git')
-rw-r--r-- | doc/topics/git/how_to_install_git/index.md | 49 | ||||
-rw-r--r-- | doc/topics/git/index.md | 19 | ||||
-rw-r--r-- | doc/topics/git/lfs/index.md | 10 | ||||
-rw-r--r-- | doc/topics/git/lfs/migrate_from_git_annex_to_git_lfs.md | 33 | ||||
-rw-r--r-- | doc/topics/git/numerous_undo_possibilities_in_git/index.md | 20 | ||||
-rw-r--r-- | doc/topics/git/partial_clone.md | 23 | ||||
-rw-r--r-- | doc/topics/git/troubleshooting_git.md | 16 | ||||
-rw-r--r-- | doc/topics/git/useful_git_commands.md | 2 |
8 files changed, 86 insertions, 86 deletions
diff --git a/doc/topics/git/how_to_install_git/index.md b/doc/topics/git/how_to_install_git/index.md index 2c3cd61f050..75ea6183a32 100644 --- a/doc/topics/git/how_to_install_git/index.md +++ b/doc/topics/git/how_to_install_git/index.md @@ -6,7 +6,7 @@ article_type: user guide date: 2017-05-15 description: 'This article describes how to install Git on macOS, Ubuntu Linux and Windows.' type: howto -last_updated: 2019-05-31 +last_updated: 2020-04-22 --- # Installing Git @@ -32,34 +32,47 @@ use one of the aforementioned methods. ### Installing Xcode -Xcode is needed by Homebrew to build dependencies. -You can install [XCode](https://developer.apple.com/xcode/) -through the macOS App Store. +To build dependencies, Homebrew needs the XCode Command Line Tools. Install +it by running in your terminal: + +```shell +xcode-select --install +``` + +Click **Install** to download and install it. Alternatively, you can install +the entire [XCode](https://developer.apple.com/xcode/) package through the +macOS App Store. ### Installing Homebrew -Once Xcode is installed browse to the [Homebrew website](https://brew.sh/index.html) +With Xcode installed, browse to the [Homebrew website](https://brew.sh/index.html) for the official Homebrew installation instructions. ### Installing Git via Homebrew -With Homebrew installed you are now ready to install Git. -Open a Terminal and enter in the following command: +With Homebrew installed, you are now ready to install Git. +Open a terminal and enter the following command: ```shell brew install git ``` -Congratulations you should now have Git installed via Homebrew. +Congratulations! You should now have Git installed via Homebrew. + +To verify that Git works on your system, run: + +```shell +git --version +``` -Next read our article on [adding an SSH key to GitLab](../../../ssh/README.md). +Next, read our article on [adding an SSH key to GitLab](../../../ssh/README.md). ## Install Git on Ubuntu Linux On Ubuntu and other Linux operating systems -it is recommended to use the built in package manager to install Git. +it is recommended to use the built-in package manager to install Git. -Open a Terminal and enter in the following commands +Open a terminal and enter the following commands to install the latest Git from the official Git maintained package archives: ```shell @@ -68,15 +81,21 @@ sudo apt-get update sudo apt-get install git ``` -Congratulations you should now have Git installed via the Ubuntu package manager. +Congratulations! You should now have Git installed via the Ubuntu package manager. + +To verify that Git works on your system, run: + +```shell +git --version +``` -Next read our article on [adding an SSH key to GitLab](../../../ssh/README.md). +Next, read our article on [adding an SSH key to GitLab](../../../ssh/README.md). ## Installing Git on Windows from the Git website -Browse to the [Git website](https://git-scm.com/) and download and install Git for Windows. +Open the [Git website](https://git-scm.com/) and download and install Git for Windows. -Next read our article on [adding an SSH key to GitLab](../../../ssh/README.md). +Next, read our article on [adding an SSH key to GitLab](../../../ssh/README.md). <!-- ## Troubleshooting diff --git a/doc/topics/git/index.md b/doc/topics/git/index.md index 019194d1bba..9e6875312f3 100644 --- a/doc/topics/git/index.md +++ b/doc/topics/git/index.md @@ -27,21 +27,27 @@ The following resources will help you get started with Git: - [Git on the Server - GitLab](https://git-scm.com/book/en/v2/Git-on-the-Server-GitLab) - [How to install Git](how_to_install_git/index.md) - [Start using Git on the command line](../../gitlab-basics/start-using-git.md) -- [Command Line basic commands](../../gitlab-basics/command-line-commands.md) +- [Command line file editing basic commands](../../gitlab-basics/command-line-commands.md) - [GitLab Git Cheat Sheet (download)](https://about.gitlab.com/images/press/git-cheat-sheet.pdf) - Commits: - [Revert a commit](../../user/project/merge_requests/revert_changes.md#reverting-a-commit) - [Cherry-picking a commit](../../user/project/merge_requests/cherry_pick_changes.md#cherry-picking-a-commit) - [Squashing commits](../gitlab_flow.md#squashing-commits-with-rebase) + - [Squash-and-merge](../../user/project/merge_requests/squash_and_merge.md) + - [Signing commits](../../user/project/repository/gpg_signed_commits/index.md) +- [Git stash](../../university/training/topics/stash.md) +- [Git file blame](../../user/project/repository/git_blame.md) +- [Git file history](../../user/project/repository/git_history.md) +- [Git tags](../../university/training/user_training.md#tags) ### Concepts -The following are resources about version control concepts: +The following are resources on version control concepts: - [Git concepts](../../university/training/user_training.md#git-concepts) - [Why Git is Worth the Learning Curve](https://about.gitlab.com/blog/2017/05/17/learning-curve-is-the-biggest-challenge-developers-face-with-git/) - [The future of SaaS hosted Git repository pricing](https://about.gitlab.com/blog/2016/05/11/git-repository-pricing/) -- [Git website topic about version control](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) +- [Git website on version control](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) - [GitLab University presentation about Version Control](https://docs.google.com/presentation/d/16sX7hUrCZyOFbpvnrAFrg6tVO5_yT98IgdAqOmXwBho/edit?usp=sharing) ## Git tips @@ -61,9 +67,10 @@ If you have problems with Git, the following may help: ## Branching strategies +- [Feature branch workflow](../../gitlab-basics/feature_branch_workflow.md) +- [GitLab Flow](../gitlab_flow.md) - [Git Branching - Branches in a Nutshell](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) - [Git Branching - Branching Workflows](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows) -- [GitLab Flow](https://about.gitlab.com/blog/2014/09/29/gitlab-flow/) ## Advanced use @@ -79,7 +86,7 @@ The following are advanced topics for those who want to get the most out of Git: [Gitignore templates](../../api/templates/gitignores.md) API allow for Git-related queries from GitLab. -## Git LFS +## Git Large File Storage (LFS) The following relate to Git Large File Storage: @@ -88,5 +95,5 @@ The following relate to Git Large File Storage: - [Removing objects from LFS](lfs/index.md#removing-objects-from-lfs) - [GitLab Git LFS user documentation](lfs/index.md) - [GitLab Git LFS admin documentation](../../administration/lfs/index.md) -- [git-annex to Git-LFS migration guide](lfs/migrate_from_git_annex_to_git_lfs.md) +- [Git Annex to Git LFS migration guide](lfs/migrate_from_git_annex_to_git_lfs.md) - [Towards a production quality open source Git LFS server](https://about.gitlab.com/blog/2015/08/13/towards-a-production-quality-open-source-git-lfs-server/) diff --git a/doc/topics/git/lfs/index.md b/doc/topics/git/lfs/index.md index 325a87215c4..33b7fa45691 100644 --- a/doc/topics/git/lfs/index.md +++ b/doc/topics/git/lfs/index.md @@ -2,7 +2,7 @@ disqus_identifier: 'https://docs.gitlab.com/ee/workflow/lfs/lfs/index.html' --- -# Git LFS +# Git Large File Storage (LFS) Managing large files such as audio, video and graphics files has always been one of the shortcomings of Git. The general recommendation is to not have Git repositories @@ -154,7 +154,7 @@ also edit it: git lfs unlock images/banner.png ``` -You can also unlock by id: +You can also unlock by ID: ```shell git lfs unlock --id=123 @@ -217,10 +217,10 @@ If you push a LFS object to a project and you receive an error similar to: the LFS client is trying to reach GitLab through HTTPS. However, your GitLab instance is being served on HTTP. -This behaviour is caused by Git LFS using HTTPS connections by default when a +This behavior is caused by Git LFS using HTTPS connections by default when a `lfsurl` is not set in the Git config. -To prevent this from happening, set the lfs url in project Git config: +To prevent this from happening, set the lfs URL in project Git config: ```shell git config --add lfs.url "http://gitlab.example.com/group/project.git/info/lfs" @@ -265,7 +265,7 @@ If you are storing LFS files outside of GitLab you can disable LFS on the projec ### Hosting LFS objects externally -It is possible to host LFS objects externally by setting a custom LFS url with `git config -f .lfsconfig lfs.url https://example.com/<project>.git/info/lfs`. +It is possible to host LFS objects externally by setting a custom LFS URL with `git config -f .lfsconfig lfs.url https://example.com/<project>.git/info/lfs`. You might choose to do this if you are using an appliance like a Sonatype Nexus to store LFS data. If you choose to use an external LFS store, GitLab will not be able to verify LFS objects which means that pushes will fail if you have GitLab LFS support enabled. diff --git a/doc/topics/git/lfs/migrate_from_git_annex_to_git_lfs.md b/doc/topics/git/lfs/migrate_from_git_annex_to_git_lfs.md index d23199fa556..05b749d7b24 100644 --- a/doc/topics/git/lfs/migrate_from_git_annex_to_git_lfs.md +++ b/doc/topics/git/lfs/migrate_from_git_annex_to_git_lfs.md @@ -1,16 +1,16 @@ # Migration guide from Git Annex to Git LFS >**Note:** -Git Annex support [has been removed][issue-remove-annex] in GitLab Enterprise +Git Annex support [has been removed](https://gitlab.com/gitlab-org/gitlab/issues/1648) in GitLab Enterprise Edition 9.0 (2017/03/22). -Both [Git Annex][] and [Git LFS][] are tools to manage large files in Git. +Both [Git Annex](http://git-annex.branchable.com/) and [Git LFS](https://git-lfs.github.com/) are tools to manage large files in Git. ## History -Git Annex [was introduced in GitLab Enterprise Edition 7.8][post-3], at a time +Git Annex [was introduced in GitLab Enterprise Edition 7.8](https://about.gitlab.com/blog/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/), at a time where Git LFS didn't yet exist. A few months later, GitLab brought support for -Git LFS in [GitLab 8.2][post-2] and is available for both Community and +Git LFS in [GitLab 8.2](https://about.gitlab.com/blog/2015/11/23/announcing-git-lfs-support-in-gitlab/) and is available for both Community and Enterprise editions. ## Differences between Git Annex and Git LFS @@ -71,13 +71,13 @@ Before changing anything, make sure you have a backup of your repository first. There are a couple of ways to do that, but you can simply clone it to another local path and maybe push it to GitLab if you want a remote backup as well. Here you'll find a guide on -[how to back up a **git-annex** repository to an external hard drive][bkp-ext-drive]. +[how to back up a **git-annex** repository to an external hard drive](https://www.thomas-krenn.com/en/wiki/Git-annex_Repository_on_an_External_Hard_Drive). Since Annex files are stored as objects with symlinks and cannot be directly modified, we need to first remove those symlinks. NOTE: **Note:** -Make sure the you read about the [`direct` mode][annex-direct] as it contains +Make sure the you read about the [`direct` mode](https://git-annex.branchable.com/direct_mode/) as it contains useful information that may fit in your use case. Note that `annex direct` is deprecated in Git Annex version 6, so you may need to upgrade your repository if the server also has Git Annex 6 installed. Read more in the @@ -114,7 +114,7 @@ if the server also has Git Annex 6 installed. Read more in the direct ok ``` -1. Disable Git Annex with [`annex uninit`][uninit]: +1. Disable Git Annex with [`annex uninit`](https://git-annex.branchable.com/git-annex-uninit/): ```shell git annex uninit @@ -170,7 +170,7 @@ GitLab.com), therefore, you don't need to do anything server-side. ``` If the terminal doesn't prompt you with a full response on `git-lfs` commands, - [install the Git LFS client][install-lfs] first. + [install the Git LFS client](https://git-lfs.github.com/) first. 1. Inside the repo, run the following command to initiate LFS: @@ -235,19 +235,8 @@ git annex uninit ## Further Reading -- (Blog Post) [Getting Started with Git FLS][post-1] -- (Blog Post) [Announcing LFS Support in GitLab][post-2] -- (Blog Post) [GitLab Annex Solves the Problem of Versioning Large Binaries with Git][post-3] +- (Blog Post) [Getting Started with Git FLS](https://about.gitlab.com/blog/2017/01/30/getting-started-with-git-lfs-tutorial/) +- (Blog Post) [Announcing LFS Support in GitLab](https://about.gitlab.com/blog/2015/11/23/announcing-git-lfs-support-in-gitlab/) +- (Blog Post) [GitLab Annex Solves the Problem of Versioning Large Binaries with Git](https://about.gitlab.com/blog/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/) - (GitLab Docs) [Git Annex](../../../administration/git_annex.md) - (GitLab Docs) [Git LFS](index.md) - -[annex-direct]: https://git-annex.branchable.com/direct_mode/ -[bkp-ext-drive]: https://www.thomas-krenn.com/en/wiki/Git-annex_Repository_on_an_External_Hard_Drive -[Git Annex]: http://git-annex.branchable.com/ -[Git LFS]: https://git-lfs.github.com/ -[install-lfs]: https://git-lfs.github.com/ -[issue-remove-annex]: https://gitlab.com/gitlab-org/gitlab/issues/1648 -[post-1]: https://about.gitlab.com/blog/2017/01/30/getting-started-with-git-lfs-tutorial/ -[post-2]: https://about.gitlab.com/blog/2015/11/23/announcing-git-lfs-support-in-gitlab/ -[post-3]: https://about.gitlab.com/blog/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/ -[uninit]: https://git-annex.branchable.com/git-annex-uninit/ diff --git a/doc/topics/git/numerous_undo_possibilities_in_git/index.md b/doc/topics/git/numerous_undo_possibilities_in_git/index.md index 9d175b2edb1..8597325db7b 100644 --- a/doc/topics/git/numerous_undo_possibilities_in_git/index.md +++ b/doc/topics/git/numerous_undo_possibilities_in_git/index.md @@ -24,7 +24,7 @@ Git is really deleted](https://git-scm.com/book/en/v2/Git-Internals-Maintenance- This means that until Git automatically cleans detached commits (which cannot be accessed by branch or tag) it will be possible to view them with `git reflog` command -and access them with direct commit-id. Read more about _[redoing the undo](#redoing-the-undo)_ on the section below. +and access them with direct commit ID. Read more about _[redoing the undo](#redoing-the-undo)_ in the section below. ## Introduction @@ -36,12 +36,12 @@ a file into the **staged** state, which is then committed (`git commit`) to your local repository. After that, file can be shared with other developers (`git push`). Here's what we'll cover in this tutorial: -- [Undo local changes](#undo-local-changes) which were not pushed to remote repository: +- [Undo local changes](#undo-local-changes) which were not pushed to a remote repository: - Before you commit, in both unstaged and staged state. - After you committed. -- Undo changes after they are pushed to remote repository: +- Undo changes after they are pushed to a remote repository: - [Without history modification](#undo-remote-changes-without-changing-history) (preferred way). - [With history modification](#undo-remote-changes-with-modifying-history) (requires @@ -68,7 +68,7 @@ joined development of the same feature by multiple developers by default. When multiple developers develop the same feature on the same branch, clashing with every synchronization is unavoidable, but a proper or chosen Git Workflow will -prevent that anything is lost or out of sync when feature is complete. +prevent that anything is lost or out of sync when the feature is complete. You can also read through this blog post on [Git Tips & Tricks](https://about.gitlab.com/blog/2016/12/08/git-tips-and-tricks/) @@ -83,7 +83,7 @@ can be on various stages and each stage has a different approach on how to tackl ### Unstaged local changes (before you commit) When a change is made, but it is not added to the staged tree, Git itself -proposes a solution to discard changes to certain file. +proposes a solution to discard changes to a certain file. Suppose you edited a file to change the content using your favorite editor: @@ -233,7 +233,7 @@ last known good commit (we assume `A`) and first known bad commit (where bug was git bisect A..E ``` -Bisect will provide us with commit-id of the middle commit to test, and then guide us +Bisect will provide us with commit ID of the middle commit to test, and then guide us through simple bisection process. You can read more about it [in official Git Tools](https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git) In our example we will end up with commit `B`, that introduced bug/error. We have 4 options on how to remove it (or part of it) from our repository. @@ -332,7 +332,7 @@ history](#how-modifying-history-is-done) Sometimes you realize that the changes you undid were useful and you want them back. Well because of first paragraph you are in luck. Command `git reflog` enables you to *recall* detached local commits by referencing or applying them -via commit-id. Although, do not expect to see really old commits in reflog, because +via commit ID. Although, do not expect to see really old commits in reflog, because Git regularly [cleans the commits which are *unreachable* by branches or tags](https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery). To view repository history and to track older commits you can use below command: @@ -353,7 +353,7 @@ eb37e74 HEAD@{6}: rebase -i (pick): Commit C 6e43d59 HEAD@{16}: commit: Commit B ``` -Output of command shows repository history. In first column there is commit-id, +Output of command shows repository history. In first column there is commit ID, in following column, number next to `HEAD` indicates how many commits ago something was made, after that indicator of action that was made (commit, rebase, merge, ...) and then on end description of that action. @@ -393,7 +393,7 @@ passwords, SSH keys, etc. It is and should not be used to hide mistakes, as it will make it harder to debug in case there are some other bugs. The main reason for this is that you loose the real development progress. **Also keep in mind that, even with modified history, commits are just detached and can still be -accessed through commit-id** - at least until all repositories perform +accessed through commit ID** - at least until all repositories perform the cleanup of detached commits (happens automatically). ![Modifying history causes problems on remote branch](img/rebase_reset.png) @@ -426,7 +426,7 @@ Never modify the commit history of `master` or shared branch. After you know what you want to modify (how far in history or how which range of old commits), use `git rebase -i commit-id`. This command will then display all the commits from -current version to chosen commit-id and allow modification, squashing, deletion +current version to chosen commit ID and allow modification, squashing, deletion of that commits. ```shell diff --git a/doc/topics/git/partial_clone.md b/doc/topics/git/partial_clone.md index a48e1c19f5c..46318a7f30d 100644 --- a/doc/topics/git/partial_clone.md +++ b/doc/topics/git/partial_clone.md @@ -9,22 +9,7 @@ is a performance optimization that "allows Git to function without having a complete copy of the repository. The goal of this work is to allow Git better handle extremely large repositories." -## Enabling partial clone - -> [Introduced](https://gitlab.com/gitlab-org/gitaly/issues/1553) in GitLab 12.4. - -To enable partial clone, use the [feature flags API](../../api/features.md). -For example: - -```shell -curl --data "value=true" --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/features/gitaly_upload_pack_filter -``` - -Alternatively, flip the switch and enable the feature flag: - -```ruby -Feature.enable(:gitaly_upload_pack_filter) -``` +Git 2.22.0 or later is required. ## Filter by file size @@ -82,7 +67,7 @@ reduce the size of your working copy. ```plaintext # Clone the repo excluding all files -$ git clone --filter=blob:none --sparse git@gitlab.com:gitlab-com/www-gitlab-com/git +$ git clone --filter=blob:none --sparse git@gitlab.com:gitlab-com/www-gitlab-com.git Cloning into 'www-gitlab-com'... remote: Enumerating objects: 678296, done. remote: Counting objects: 100% (678296/678296), done. @@ -135,7 +120,7 @@ enabled on the Git server: many applications, each in a different subdirectory in the root. Create a file `shiny-app/.filterspec` using the GitLab web interface: - ```.gitignore + ```plaintext # Only the paths listed in the file will be downloaded when performing a # partial clone using `--filter=sparse:oid=shiny-app/.gitfilterspec` @@ -153,7 +138,7 @@ enabled on the Git server: shared-component-b/ ``` -1. *Create a new Git repository and fetch.* Support for `--filter=sparse:oid` +1. **Create a new Git repository and fetch.** Support for `--filter=sparse:oid` using the clone command is incomplete, so we will emulate the clone command by hand, using `git init` and `git fetch`. Follow [issue tracking support for `--filter=sparse:oid`](https://gitlab.com/gitlab-org/git/issues/4) diff --git a/doc/topics/git/troubleshooting_git.md b/doc/topics/git/troubleshooting_git.md index f8d812d37e6..010a811bd33 100644 --- a/doc/topics/git/troubleshooting_git.md +++ b/doc/topics/git/troubleshooting_git.md @@ -13,7 +13,7 @@ with Git. 'Broken pipe' errors can occur when attempting to push to a remote repository. When pushing you will usually see: -```text +```plaintext Write failed: Broken pipe fatal: The remote end hung up unexpectedly ``` @@ -56,7 +56,7 @@ Configuring *both* the client and the server is unnecessary. - On UNIX, edit `~/.ssh/config` (create the file if it doesn’t exist) and add or edit: - ```text + ```plaintext Host your-gitlab-instance-url.com ServerAliveInterval 60 ServerAliveCountMax 5 @@ -68,7 +68,7 @@ Configuring *both* the client and the server is unnecessary. **To configure SSH on the server side**, edit `/etc/ssh/sshd_config` and add: -```text +```plaintext ClientAliveInterval 60 ClientAliveCountMax 5 ``` @@ -93,7 +93,7 @@ to >= 2.9 (see [Broken pipe when pushing to Git repository](https://stackoverflo Users may experience the following error when attempting to push or pull using Git over SSH: -```text +```plaintext Please make sure you have the correct access rights and the repository exists. ... @@ -103,7 +103,7 @@ fatal: Could not read from remote repository. or -```text +```plaintext ssh_exchange_identification: Connection closed by remote host fatal: The remote end hung up unexpectedly ``` @@ -117,7 +117,7 @@ beginning. The default value is `10`. Increase `MaxStartups` on the GitLab server by adding or modifying the value in `/etc/ssh/sshd_config`: -```text +```plaintext MaxStartups 100:30:200 ``` @@ -140,7 +140,7 @@ If pulling/pushing from/to your repository ends up taking more than 50 seconds, a timeout will be issued with a log of the number of operations performed and their respective timings, like the example below: -```text +```plaintext remote: Running checks for branch: master remote: Scanning for LFS objects... (153ms) remote: Calculating new repository size... (cancelled after 729ms) @@ -153,7 +153,7 @@ and provide GitLab with more information on how to improve the service. If the buffer size is lower than what is allowed in the request, the action will fail with an error similar to the one below: -```text +```plaintext error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF diff --git a/doc/topics/git/useful_git_commands.md b/doc/topics/git/useful_git_commands.md index 63defb24eaf..711567dbd06 100644 --- a/doc/topics/git/useful_git_commands.md +++ b/doc/topics/git/useful_git_commands.md @@ -116,7 +116,7 @@ git log <file> If you get this error message: -```text +```plaintext fatal: ambiguous argument <file_name>: unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: ``` |