搜索
首页后端开发php教程GIT在Linux上的安装和使用简介,gitlinux安装简介_PHP教程

GIT在Linux上的安装和使用简介,gitlinux安装简介

<span>GIT在Linux上的安装和使用简介

解压后切换到其目录
$ tar xvfj git</span>-1.7.6.tar.<span>bz2
$ cd git</span>-1.7.6<span>
 
使用默认配置进行安装,如果想修改配置,可以使用 </span>./configure --<span>help 来获取帮助
 
$ </span>./<span>configure
$ make
$ make install
 
</span>2<span>、初始化配置
GIT默认安装在 </span>/usr/local/<span>bin ,安装之后可以验证一下是否安装好
 
$ whereis git
git</span>: /usr/local/bin/<span>git
$ git  </span>--<span>version
git version </span>1.7.6<span>
$ git  </span>--<span>help
 
首先需要指定用户名和电子邮件地址
 
$ git config  </span>--<span>global</span> user.<span>name &ldquo;GIT Admin&rdquo;
$ git config  </span>--<span>global</span> user.emal obugs.net@gmail.<span>com
 
再验证一下配置信息
  www</span>.2cto.<span>com  
$ git config  </span>--<span>list</span><span>
user</span>.name=<span>GIT Admin
user</span>.email=obugs.net@gmail.<span>com
core</span>.repositoryformatversion=0<span>
core</span>.filemode=<span>true</span><span>
core</span>.bare=<span>false</span><span>
core</span>.logallrefupdates=<span>true</span><span>
 
其实这些配置是存放在个人主目录下的 </span>.<span>gitconfig 文件中的
 
$ cat </span>~/.<span>gitconfig
[user]
name </span>=<span> GIT Admin
email </span>= obugs.net@gmail.<span>com
 
</span>3<span>、建立工程
本地存储的任何一个目录都可以建立GIT工程,如果已有工程位于 </span>/home/obugs/projects/<span>orangebugs 目录,就可以把这目录定义为GIT工程
$ cd </span>/home/obugs/projects/<span>orangebugs
$ git init
Initialized </span><span>empty</span> Git repository in /home/obugs/projects/orangebugs/.git/<span>
 
这样就建立了一个名为 </span>.<span>git 的文件夹,这就是GIT用来存储信息和跟踪改动的文件夹。
  www</span>.2cto.<span>com  
$ ls </span>-altr .<span>git
total </span>40<span>
drwxrwxr</span>-x 4 git git 4096 Aug 13 22:39<span> refs
drwxrwxr</span>-x 4 git git 4096 Aug 13 22:39<span> objects
drwxrwxr</span>-x 2 git git 4096 Aug 13 22:39<span> info
drwxrwxr</span>-x 2 git git 4096 Aug 13 22:39<span> hooks
</span>-rw-rw-r -- 1 git git 23 Aug 13 22:39<span> HEAD
</span>-rw-rw-r -- 1 git git 73 Aug 13 22:39<span> description
</span>-rw-rw-r -- 1 git git 92 Aug 13 22:39<span> config
drwxrwxr</span>-x 2 git git 4096 Aug 13 22:39<span> branches
drwxrwxr</span>-x 36 git git 4096 Aug 13 22:39 ..<span>
drwxrwxr</span>-x 7 git git 4096 Aug 13 22:39 .
 
4<span>、向工程添加和提交文件
这些动作和CVS、SVN等操作类似
 
$ git add </span>*.java *.<span>c
$ git commit </span>-<span>m &lsquo;Initial upload of the project&rsquo;
create mode </span>100755 Orangebugs.<span>java
create mode </span>100755 pwm/ui/DataManager.<span>java
create mode </span>100755 pwm/ui/PasswordFrame.<span>java
create mode </span>100755 pwm/tools/StrongEncryption.<span>java
create mode </span>100755 pwm/tools/PasswordStrength.<span>java
</span>..<span>
 
注意如果之前没有使用 git config 指定用户名和电子邮件地址,这里会报错
$ git commit </span>-m &lsquo;Initial upload of the project'<span>
 
*** Please tell me who you are.
  www.2cto.com  
Run
 
git config  --global user.email &ldquo;you@example.com&rdquo;
git config  --global user.name &ldquo;Your Name&rdquo;
 
to set your account&rsquo;s default identity.
Omit  --global to set the identity only in this repository.
 
fatal: empty ident not allowed
 
5、更改文件和提交改动
编辑文件、添加或者删除了一些字段
$ vi Orangebugs.java
 
查看和GIT仓库中的文件相比有了那些改动
 
$ git diff
diff  --git a/Orangebugs.java b/Orangebugs.java
index 6166ed1..fd82d32 100644
&mdash; a/Orangebugs.java
+++ b/Orangebugs.java
@@ -2,7 +2,7 @@
- public counter=10
+ public counter=55
 
如果要提交,需要先确保将文件添加到了临时区域(staging area)然后才能提交,提交时会自动打开系统的默认编辑器,用户添加一些注释后保存并退出编辑器的时候,这些注释就同时提交到仓库中去了
  www.2cto.com  
$ git add Orangebugs.java
$ git commit
[master 80f10a9] Added password strength meter functionality
1 files changed, 56 insertions(+), 7 deletions(-)
或者,简单一点的方法是使用 git commit -a 把上面两个命令合二为一。
6、查看状态和查看注释
如果本地的文件和远端GIT仓库上的文件相比没有任何改动,则
 
$ git status
# On branch master
nothing to commit (working directory clean)
 
如果本地做了改动但是没有提交,则
 
$ git status
# On branch master
# Changes not staged for commit:
# (use &ldquo;git add &hellip;&rdquo; to update what will be committed)
# (use &ldquo;git checkout &mdash; &hellip;&rdquo; to discard changes in working directory)
#
# modified: Orangebugs.java
#
no changes added to commit (use "git add" and/or "git commit -a")
 
另外,可以用下面的命令查看文件历史和以往的注释
 
$ git log Orangebugs.java
commit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5
Author: GIT Admin  www.2cto.com  
Date: Sat Aug 13 22:54:57 2011 -0700
 
Added password strength meter functionality
 
commit c141b7bdbff429de35e36bafb2e43edc655e9957
Author: GIT Admin
Date: Sat Aug 13 20:08:02 2011 -0700
 
Initial upload of the project</span>

linux下版本管理git的安装方法,安装包,以及详细的使用介绍,高分重谢

Google一下到处都是
如果你用Ubuntu的话在终端打sudo apt-get install git就装好了
用arch的话打sudo pacman -S git
各种包管理应该都可以 看你用哪种了
自己下代码编译也成
使用的话一两句话说不清 自己去Google教程吧
 

linux ,ubuntu使用git问题怎让git记录我的版本?

用分支或者标签实现,不过看上去标签应该更加合适
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/847128.htmlTechArticleGIT在Linux上的安装和使用简介,gitlinux安装简介 GIT在Linux上的安装和使用简介解压后切换到其目录$ tar xvfj git -1.7.6.tar. bz2$ cd git -1.7.6 使用默...
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
绝对会话超时有什么区别?绝对会话超时有什么区别?May 03, 2025 am 12:21 AM

绝对会话超时从会话创建时开始计时,闲置会话超时则从用户无操作时开始计时。绝对会话超时适用于需要严格控制会话生命周期的场景,如金融应用;闲置会话超时适合希望用户长时间保持会话活跃的应用,如社交媒体。

如果会话在服务器上不起作用,您将采取什么步骤?如果会话在服务器上不起作用,您将采取什么步骤?May 03, 2025 am 12:19 AM

服务器会话失效可以通过以下步骤解决:1.检查服务器配置,确保会话设置正确。2.验证客户端cookies,确认浏览器支持并正确发送。3.检查会话存储服务,如Redis,确保其正常运行。4.审查应用代码,确保会话逻辑正确。通过这些步骤,可以有效诊断和修复会话问题,提升用户体验。

session_start()函数的意义是什么?session_start()函数的意义是什么?May 03, 2025 am 12:18 AM

session_start()iscucialinphpformanagingusersessions.1)ItInitiateSanewsessionifnoneexists,2)resumesanexistingsessions,and3)setsasesessionCookieforContinuityActinuityAccontinuityAcconActInityAcconActInityAcconAccRequests,EnablingApplicationsApplicationsLikeUseAppericationLikeUseAthenticationalticationaltication and PersersonalizedContentent。

为会话cookie设置httponly标志的重要性是什么?为会话cookie设置httponly标志的重要性是什么?May 03, 2025 am 12:10 AM

设置httponly标志对会话cookie至关重要,因为它能有效防止XSS攻击,保护用户会话信息。具体来说,1)httponly标志阻止JavaScript访问cookie,2)在PHP和Flask中可以通过setcookie和make_response设置该标志,3)尽管不能防范所有攻击,但应作为整体安全策略的一部分。

PHP会议在网络开发中解决了什么问题?PHP会议在网络开发中解决了什么问题?May 03, 2025 am 12:02 AM

phpsessions solvathepromblymaintainingStateAcrossMultipleHttpRequestsbyStoringDataTaNthEserVerAndAssociatingItwithaIniquesestionId.1)他们储存了AtoredAtaserver side,通常是Infilesordatabases,InseasessessionIdStoreDistordStoredStoredStoredStoredStoredStoredStoreDoreToreTeReTrestaa.2)

可以在PHP会话中存储哪些数据?可以在PHP会话中存储哪些数据?May 02, 2025 am 12:17 AM

phpsessionscanStorestrings,数字,数组和原始物。

您如何开始PHP会话?您如何开始PHP会话?May 02, 2025 am 12:16 AM

tostartaphpsession,usesesses_start()attheScript'Sbeginning.1)placeitbeforeanyOutputtosetThesessionCookie.2)useSessionsforuserDatalikeloginstatusorshoppingcarts.3)regenerateSessiveIdStopreventFentfixationAttacks.s.4)考虑使用AttActAcks.s.s.4)

什么是会话再生,如何提高安全性?什么是会话再生,如何提高安全性?May 02, 2025 am 12:15 AM

会话再生是指在用户进行敏感操作时生成新会话ID并使旧ID失效,以防会话固定攻击。实现步骤包括:1.检测敏感操作,2.生成新会话ID,3.销毁旧会话ID,4.更新用户端会话信息。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器