SourceTree 的初次使用的两个小问题

菜鸟才开始使用SourceTree,出现了两个小问题,特此整理一下,希望对各位新手有帮助。刚开始以为装了SourceTree就不用装git了,其实不然,不装git就会出现下面第一个问题:

1、新手使用SourceTree 一定要装git客户端才行,不然克隆远程url会一直提示 “这是一个无效的源路径/URL”(本人已经掉坑里一次了,希望读者不要再犯这么简单的错误)

如图所示

原因:没有启用git(截图忘记保存了)

解决办法:工具 ——》选项  ——》 git, 启用git 就可以了。

启用之后如图:

2、提交代码到远程的时候报错,提示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -F C:UsersAppDataLocalTempyo1s42oy.fz2
 
*** Please tell me who you are.
 
Run
 
  
 git config --global user.email "you@example.com"
  
 git config --global user.name "Your Name"
 
 
to set your account's default identity.
Omit
 --global to set the identity only in this repository.
 
fatal:
 unable to auto-detect email address (got 'Colin@JustForMoney.(none)')

  如图:

原因:没有设置用户名和邮箱

解决办法:运行git;敲如下命令

1
2
3
git config --global user.email "you@example.com"
 
git config --global user.name "Your Name"

 设置完毕之后,就可以正常使用了。

原文地址:https://www.cnblogs.com/soundcode/p/7212176.html