Git新手常见问题总结

一. Please tell me who you are
1. 问题描述:初次使用git时,会遇到这样的提示
Please tell me who you are.
Run
  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
2. 解决:参考提示,在命令行运行如下命令,Tell git who you are
git config --global user.email  "[email protected]"
git config --global user.name "Your Name"
二. fatal: remote origin already exists.
1.问题描述:重复git remote add origin 同一个远程仓库时,会出现这个错误,可以理解为重复对origin进行绑定出错
2. 解决:
git remote rm origin 
三. 使用https://github.com/../..域名提交项目,会要求提交用户名和密码,用户名即github账号,密码即github的密码
四. Please make sure you have the correct access rights
1.问题描述:初次提交项目到远程仓库,会出现错误如下,原因是没有在远程配置本地密钥
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
2.解决:
  1. 使用 ssh-keygen -t rsa -C "[email protected]"生成密钥
  2. 在~/.ssh 目录下,有id_rsa,id_rsa.pub两个文件,把id_ras.pub的内容添加到github.com的账号下。
    参考廖雪峰git教程

你可能感兴趣的:(Git新手常见问题总结)