git 新手指南

1. 安装配置

1.1. 安装

Linux

debian 系

1
sudo apt-get install git

rpm 系

1
sudo dnf install git-all

Windows

1
winget install Git.Git
阅读更多

基于 "VSCode Remote Devlopment" 进行开发时,如何共享 Windows 下的Git认证信息给Remote

在Windows下,使用 VSCode 做Linux应用开发,可以使用 VSCode Remote Devlopment 实现。

那么在 Remote 环境下进行 Git 同步时,我们希望直接使用 Windows下的 Git 认证信息,而不是在 Remote 端重复配置。这样就可以做到Git认证信息只存在于Windows上,而避免扩散到 Remote上。

那么如何共享 Windows下的Git认证信息给Remote呢?

阅读更多

git 合并多个commit为一个

有时候为了使 git log 看起来更简洁,需要合并多个commit为一个(例如:在一个分支做开发时,创建了很多commit,提交Pull Request,需要作为一个commit 提交)

阅读更多

Powershell 下的 git 自动补全

Powershell(Windows) 下实现 git 自动补全,可以通过 Posh-Git

1
2
3
4
5
6
7
8
9
# 安装
Install-Module -Name posh-git -Repository PSGallery -Scope CurrentUser

# 配置 $PROFILE
Add-Content -Path $PROFILE -Value @'
# posh-git
Import-Module -Name posh-git

'@

gitlab api token 如何用于 git 认证

基于http协议进行git同步(例如 git clone, git push等),有时候需要进行http认证。

对于用 gitlab 托管的项目,在 http 认证方案中,可以用用户名密码作为认证方案,也可以用 gitlab api token作为认证方案。而 gitlab 官方更加推荐 api token的认证方案。

阅读更多