Git 使用备忘

转载请注明来源 http://blog.csdn.net/imred/article/details/49454321
生成SSH key:ssh-keygen -t rsa -b 4096 -C “[email protected]

将key添加到ssh-agent:

打开ssh-agent:

ssh-agent -s
or eval $(ssh-agent -s)

添加key:ssh-add ~/.ssh/id_rsa

测试能否以SSH方式连接到远程仓库:ssh -T [email protected]([email protected])
设置用户名:git config –global user.name “xxx”
设置邮箱:git config –global user.email [email protected]
初始化Git仓库:git init
增加新文件:git add xxx
忽略某些文件:echo *.log >> .gitignore
提交:git commit -am “some message”
查看状态:git status
移动文件:git mv
删除暂存区中的文件:git rm –cached xxx
查看提交历史:git log
添加远程仓库:git remote add origin https://xxx.com/yyy/zzz
([email protected]:username/xxx.git)
删除/重命名远程仓库:git remote rm/mv origin [new]
push到远程仓库:git push origin master
转载请注明来源 http://blog.csdn.net/imred/article/details/49454321

你可能感兴趣的:(git,ssh)