tortoiseGit 在gitlab下入坑指北

如何让git小乌龟工具记住Git账号密码 免多次登录

在使用小乌龟的过程中,发下每次push或者pull都要重复输入账号密码,非常麻烦。

如果能记住账号密码就好了,这样就省去了时间。

怎么设置记住密码

在[系统盘]:Users[你的用户名]下面,有一个.gitconfig目录,这个是记录你的git配置信息的。
在该文件后面加上

  1. [user]
  2. name = xx
  3. email = xx@xx.com
  1. 新添加
  2. [credential]
  3.     helper = store
  4.  

保存后。试一下pull或者push,就会在[系统盘]:Users[你的用户名]目录下面生成

.git-credentials文件,该文件明文记录了你输入的账号密码

http://username:password@git.llpp.com  

如果用的是 ssh:
  1. 在当前用户文件夹如 %userprofile% 下新建一个名为_netrc的文件。
  2. 编辑该文件:
  3. machine gitlab.tools.vipshop.com
    login $username$
    password ******

tortoisegit 连接 gitlab 不用输入密码的二种方式

1,http的方式连接 : 规则是:http://用户名:密码@giturl

 2,ssh的方式连接: 

2.1 利用tortoisegit的puttygen生成,pub key和pri key

2.2 登录gitlab后台,将pub key保存到ssh key中

2.3 本地clone,push,fetch时,引入pri key就行了。

如果,你确定成功完成,还是不能ssh的方法,来clone,push,fetch的话,检查以一下内容:

1,关闭selinux

[root@localhost ~]# cat /etc/sysconfig/selinux 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled             //把这个disabled掉
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

2,修改sshd_config

[root@localhost ~]# vim /etc/ssh/sshd_config  //将下面三行,注释拿掉

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys      

 

 

Git如何上传空文件夹?

1. 通过 (以下2选1)

.gitignore

# Ignore everything in this directory
 * 
# Except this file
!.gitignore

.gitkeep

# Ignore everything in this directory 
* 
# Except this file !.gitkeep 

1.1 创建.开头的文件夹:用cmd命令行 mkdir .t1或者md .t2

      创建.开头的文件:用cmd命令行 echo> .gitignore

 

 
原文地址:https://www.cnblogs.com/Chary/p/13892680.html