Git&GitHub安装与基础使用教程

需积分: 10 1 下载量 149 浏览量 更新于2024-08-05 收藏 10.61MB DOCX 举报
"Git&GitHub笔记详细介绍了Git和GitHub的基础知识,包括版本控制工具的核心功能、版本控制的历史和类型,以及Git的特点和安装步骤。" Git是一个强大的分布式版本控制系统,它由Linux创始人Linus Torvalds开发,旨在解决在软件开发中的协同修改、数据备份、版本管理和权限控制等问题。Git具有以下主要特点: 1. **协同修改**:Git允许多个开发者同时修改服务器端的同一文件,通过合并冲突来确保协同工作的顺利进行。 2. **数据备份**:Git不仅保存当前的工作状态,还保存每次提交的历史记录,确保代码的安全性。 3. **版本管理**:Git采用了文件系统快照的方式,每次提交都是一个完整的版本,这使得回溯历史版本变得简单且高效。 4. **权限控制**:Git提供了权限管理机制,可对团队成员的访问权限进行设定,并允许对外部贡献者的代码进行审核。 5. **历史记录**:Git能详细记录每一次的修改,包括修改人、时间、内容和提交日志,方便追踪代码变更。 6. **分支管理**:Git的分支系统强大,支持快速创建和合并分支,鼓励开发团队并行开发,提升工作效率。 Git相对于集中式版本控制系统(如CVS、SVN)的一大优势在于其分布式特性,大部分操作在本地完成,无需持续联网,提高了效率和响应速度。此外,Git的完整性保证依赖于哈希运算,确保数据不被篡改。它的分支操作非常流畅,因为分支本质上是轻量级的,创建和切换都非常迅速。 Git的安装通常很简单,对于Windows用户,可以通过提供的链接按照教程进行安装。Linux用户则可以直接通过包管理器安装。安装过程中,用户需要选择默认的文本编辑器,配置环境变量,选择本地库和远程库的连接方式,以及确定换行符处理方式和终端类型。 GitHub是一个基于Git的代码托管平台,开发者可以在这里创建仓库,协作开发项目,并利用其丰富的社区资源和工具,如问题跟踪、代码审查、持续集成等。结合Git使用GitHub,可以极大地促进开源项目的协作和软件开发流程的规范化。

Fetching upstream changes from git@github. com:a792883583/treeHoleScore.git > /usr/bin/git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT _ASKPASS to set credentials github > /usr/bin/git fetch --tags --progress git@github. com:a792883583/treeHoleScore.git +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson. plugins.git.GitException: Failed to fetch from git@github. com:a792883583/treeHoleScore.git at hudson. plugins . git .GitSCM. fetchFrom(GitSCM. java:1003) at hudson. plugins .git .GitSCM. retrieveChanges(GitSCM. java:1245) at hudson.plugins.git.GitsCM. checkout(GitSCM. java:1309) at hudson.scm. SCM. checkout(SCM. java:540) at hudson. mode1. AbstractProject . checkout(AbstractProject . java:1240) at hudson. model AbstractBuild$AbstractBuildExecution. def aultCheckout (AbstractBuild. java:649) at jenkins .scm. SCMCheckoutStrategy . checkout(SCMCheckoutStrategy . java:85) at hudson . model. AbstractBuild$AbstractBuildExecution. run(AbstractBuild. java:521) at hudson.model . Run. execute(Run. java:1900) at hudson.model. FreeSty1eBuild.run(FreeStyleBuild.java:44) at hudson. model. ResourceController . execute(ResourceController . java:101) at hudson. model. Executor .run(Executor. java:442) Caused by: hudson. plugins.git .GitException: Command "/usr/bin/git fetch --tags --progress git@github . com: a792883583/treeHoleScore.git +refs/heads/* :refs/remotes/origin/*" returned status code 128: stdout: stderr: Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. at org.jenkinsci .plugins.gitclient .CliGitAPIImp1.1aunchCommandIn(CliGitAPImp1.java:2734) at org.jenkinsci .plugins.gitclient .CliGitAPIImp1.1aunchCommandWithCredentials(CliGitAPIImpl.java:2111) at org.jenkinsci.plugins . gitclient .CliGitAPIImp1$1. execute(CliGitAPIImp1.java:623) at hudson.p1ugins . git .GitSCM. fetchFrom (GitSCM. java:1001) 11 more ERROR: Error fetching remote repo ' origin' Finished: FAILURE

2023-02-08 上传