使用git需要创建sshkey. 否则无法完成对远程仓库的clone push等操作.
sshkey目录在~/.ssh
step1: 创建新的 sshkey
终端输入
ssh-keygen -t rsa -C 'Email@mail.com' -f ~/.ssh/id_rsa_oschina
step2 : 创建配置文件 config
vi ~/.ssh/config
内容 :
Host git.oschina.net #git.oschina.net
HostName git.oschina.net
User git
IdentityFile ~/.ssh/id_rsa_osc
Host github.com #github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
step3: 连接本地和git远程仓库
ssh -T git@XXXXX.com
step4: 连接本地仓库master和远程master分支
此时就已经和远程仓库联系上了. 但当时出了这样一个问题.
pathspec master did not match any file(s) known to git
原来本地的maste分支还不能和远程的master分支建立追踪关系
Git使用之(pathspec master did not match any file(s) known to git)
git branch -u origin/master master
参考资料:
http://www.cnblogs.com/BenWong/p/4268029.html
http://blog.csdn.net/wj2030/article/details/46763477?ref=myread
Git使用之(pathspec master did not match any file(s) known to git)
网友评论