- 注册一个github账户,路径:https://github.com/join?source=login
- 申请账户后,创建一个代码仓库; ”start a project”
- 创建仓库,其中respository name 仓库名称;由于演示,code创建,就code1作为用例
- 以上已建立了用户信息,可以下载github 客户端了,打开“open in desktop”下载安装版本,也可以直接 git下载
- 安装完成git后,创建一个git目录,把项目放进git目录下,选择git目录,鼠标右键选择 "git bash here"
- 输入命令;git clone https://github.com/sunnyJam/code.git,并回车
- 代码复制,git clone操作会在git文件中生成一个code仓库,把代码copy到code仓库中
- 进入code仓库目录cd code
- 接下来输入依次输入以下命令
git add . (注:别忘记后面的.,此操作是把Test文件夹下面的文件都添加进来)
git commit -m "提交信息" (注:“提交信息”里面换成你需要,如“我的项目”)
git push -u origin master (注:此操作目的是把本地仓库push到github上面,此步骤需要你输入帐号和密码)
-
至此我的代码上传成功了
-
如果输入用户信息错误,提示“git提示unable to auto-detect email address” git config --global user.email "我的邮箱" git config --global user.name "姓名"