首页 > 其他 > 详细

git常见用法

时间:2015-06-18 02:15:45      阅读:202      评论:0      收藏:0      [点我收藏+]

使用gitlab

(1)删除已有的公钥
bubuko.com,布布扣
?

?

(2)使用git bash创建RSA 公私玥

使用命令:ssh-keygen.exe

私钥默认路径:/c/Users/admin/.ssh/id_rsa

执行结果:

$ ssh-keygen.exe
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/admin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/admin/.ssh/id_rsa.
Your public key has been saved in /c/Users/admin/.ssh/id_rsa.pub.
The key fingerprint is:
31:87:7e:23:33:8f:70:61:c9:29:66:a4:7e:2c:db:98 admin@ADMIN-PC
The key‘s randomart image is:
+--[ RSA 2048]----+
|????? .????????? |
|???? o . +?????? |
|??? . + X .????? |
|?? . + + =?????? |
|??? o + S o????? |
|???? B o B .???? |
|??? E . . .????? |
|???????????????? |
|???????????????? |
+-----------------+
bubuko.com,布布扣
?

生成的公私玥:
bubuko.com,布布扣
?其中,id_rsa.pub 是公钥,需要拷贝id_rsa.pub内容到github中
bubuko.com,布布扣
?把上述内容拷贝到github中,如下图
bubuko.com,布布扣
?

注意:内容后面不能有空格和换行.

添加成功:
bubuko.com,布布扣
?这样就可以使用git bash直接clone 代码库勒.

使用命令:git clone git@gitlab.rd.chanjet.com:aaa/bb_web.git
bubuko.com,布布扣
?

查看分支:

git branch -r
bubuko.com,布布扣
?

检出指定分支

git checkout origin/dev_revert_online
bubuko.com,布布扣
?

提交修改的文件(commit)

第一次提交时失败
bubuko.com,布布扣
解决方法:

先执行:git config --global user.email "huangwei@chanjet.com"
bubuko.com,布布扣
?然后就提交成功了
bubuko.com,布布扣
?

查看最后一个commit了的文件

git log -n 1
bubuko.com,布布扣
?

?

?

?

提交流程

git add index.html

git commit -m "test" *

git push
bubuko.com,布布扣
?

$ git checkout
Your branch is up-to-date with ‘origin/master-bug‘.

?

?

?

?

?

git常见用法

原文:http://hw1287789687.iteye.com/blog/2220456

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!