一、在本地创建的项目文件夹中右键,点开git bush面板:输入:git init
在该文件下就会有一个隐藏文件,‘.git’,
(此时在gitee.com上应该已经创建有一个空的远程仓库了)
二、在git Bush中,输入git remote add 远程仓库名 远程仓库地址
这一步是连接上远程仓库,
远程仓库的相关操作
检出仓库:$ git clone git://github.com/jquery/jquery.git
查看远程仓库:$ git remote -v
添加远程仓库:$ git remote add [name] [url]
删除远程仓库:$ git remote rm [name]
修改远程仓库:$ git remote set-url --push [name] [newUrl]
拉取远程仓库:$ git pull [remoteName] [localBranchName]
推送远程仓库:$ git push [remoteName] [localBranchName]
三、将代码添加到本地仓库,在进行提交,
git add .
可能报错信息:
git:'add.' is not is a git command .See 'git --help'.
这个是格式问题:add后面打个空格哈哈哈哈
LF will be replaced by CRLF the next time Git touches it:
这个是git bush的设置将回车作为符号了,打回车,无法编译。
解决办法:
git config --global core.autocrlf false
四、提交代码:git commit -m "注释内容"
注意第一次提交要写注释内容,不然可能会报错Aborting commit due to empty commit message.
五、提交上gitee远程仓库
git push 远程仓库名 仓库路径
可能报错:
error: failed to push some refs to 'https://gitee.com/xixi_12138/workspace.git'
说明远程仓库有本文件夹没有的文件,删掉远程仓库的文件,变成空远程仓库然后再拉取一遍进行同步,或者直接执行拉取远程仓库git pull --rebase 远程仓库名 分支名。
到此gitee的仓库上就有项目文件啦