Git常用命令集合

来源:互联网 发布:淘宝网双11 编辑:程序博客网 时间:2024/05/19 05:01

1.创建一个版本库

$ mkdir learngit$ cd learngit$ pwd/Users/michael/learngit


将目录变成Git可以管理的仓库:

$ git initInitialized empty Git repository in /Users/michael/learngit/.git/

将文件添加和提交到仓库:

$ git add readme.txt$git commit -m"wrote a reademe file"

2.远程仓库

创建SSH Key:

$ ssh-keygen -t rsa -C "youremail@example.com"

添加远程库:

$ git remote add origin git@github.com:michaelliao/learngit.git

把本地的所有内容推送到远程库:

$ git push -u origin master

未完待续。。