当前位置: 首页 > 工具软件 > DevOps-Guide > 使用案例 >

DevOps - Git - 基础介绍

归俊捷
2023-12-01

Git

Git - HomePage Git - CHEAT SHEET
开源的分布式版本控制系统,用于敏捷高效地管理项目版本。

下载与安装Git

https://git-scm.com/downloads
https://git-for-windows.github.io/

Git - The Simple Guide

English 中文简体

Git帮助信息

# Display the version of git.
git version

# Display the brief help
git <COMMAND> -h

# Display help for specific subcommand or concept.
git help <COMMAND/CONCEPT>  
git  <COMMAND/CONCEPT> --help

git help  # Prints the synopsis and a list of the most commonly used commands.
git help git  # Display the git man page.

git help --help  # Display the help of 'git help'
git help --all  # Print all available commands on the standard output.
git help --guide  # Print a list of the useful Git guides on the standard output.

Git代理设置

设置全局代理
git config --global https.proxy https://10.144.1.10:8080 git config --global http.proxy http://10.144.1.10:8080
去除全局代理
git config --global --unset http.proxy git config --global --unset https.proxy

区别Git/GitHub/GitLab

Git
https://git-for-windows.github.io/
版本控制工具:开源的分布式版本控制。

GitHub

  • GitHub - HomePage
  • GitHub - GIT CHEAT SHEET
    基于git的面向开源及私有软件项目的托管平台,因为只支持 Git 作为唯一的版本库格式进行托管,故名 GitHub。
    用户能够以web或者客户端的形式创建和管理git仓储,保存用户的一些数据文档或者代码等,并通过和远端的github进行同步更新,实现对项目的管理。

GitLab
HomePage
基于git的项目管理软件:开源的仓库管理系统项目,使用git作为代码管理工具,并在此基础上搭建web服务,拥有与Github类似的功能。

参考信息

Git及GitHub简单使用示例

设置全局登录名称和邮箱
git config --global user.name "<Login name>"
git cofnig --global user.email "<Email address>"

创建SSH Key
ssh-keygen -t rsa –C "<Email address>"

配置GitHub

  1. 如果使用ssh方式,配置ssh认证。
  2. 创建git仓库,确认git仓库信息, 例如:https://github.com/AnlivenCoding/test.git

创建本地git仓库并推送

$ cd /d/Anliven-Running/Zen/test/        # 进入目录
$ echo "# PythonLearning" >> README.md        # 创建说明文件
$ git init        # 将当前目录变成本地Git仓库
$ git add *        # 添加所有文件到本地仓库的暂存区(Index/Stage)
$ git commit -m "first commit"        # 提交文件到本地仓库
$ git remote add origin https://github.com/AnlivenCoding/test.git        # 关联本地仓库和远端仓库
$ git push -u origin master         # 第一次推送本地仓库内容到远端仓库master分支
$ git push origin master         # 第一次推送本地仓库内容到远端仓库master分支

which-remote-url-should-i-use

克隆远端仓库到本地

$ git clone https://github.com/AnlivenCoding/test.git
Cloning into 'test'...
remote: Counting objects: 237, done.
remote: Compressing objects: 100% (217/217), done.
remote: Total 237 (delta 11), reused 237 (delta 11), pack-reused 0
Receiving objects: 100% (237/237), 153.18 KiB | 138.00 KiB/s, done.
Resolving deltas: 100% (11/11), done.
Checking connectivity... done.

转载于:https://www.cnblogs.com/anliven/p/6069393.html

 类似资料: