git常用命令以及常见问题记录

git 常用命令


$ git init 初始化本地仓库

$ git remote add origin [email protected]:yourName/repositoryname.git 连接远程仓库

$ git status 查看仓库状态

$ git add readme.md 添加修改

$ git checkout -- readme.md 撤销修改

$ git rm readme.md 删除文件

$ git commit -m "some useful information" 提交

$ git push origin master 推送至远程仓库

git常见问题

1.push报错

$ git push -u origin master 失败报错

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: xxxxxxxxxxxx

首先测试ssh连接

$ ssh -T [email protected]

显示以下信息则表示连接没问题,密钥对配置没问题

Hi yhonker! You've successfully authenticated, but GitHub does not provide shell access.

猜你喜欢

转载自www.cnblogs.com/HonkerYblogs/p/12316448.html