配置GIT
1)在本地仓库里右键选择Git Bash进入git命令行,执行
$ git init
2)查看状态
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/workspace.xml
nothing added to commit but untracked files present (use "git add" to track)
Richer@Richer-pc MINGW64 /f/www/cms (master)
3)配置提交用户名称和邮件地址
$ git config --global user.name "Richar"
Richer@Richer-pc MINGW64 /f/www/cms (master)
$ git config --global user.email 2xxxx0@qq.com
4)将当前目录下代码上传至GIT
$ git add .
$ git commit -m "initial commit"
[master 6bf1af6] initial commit
1 file changed, 256 insertions(+)
create mode 100644 .idea/workspace.xml
Richer@Richer-pc MINGW64 /f/www/cms (master)
$ git remote add origin https://github.com/Richerjx/cms.git
fatal: remote origin already exists.
Richer@Richer-pc MINGW64 /f/www/cms (master)
$ git remote rm origin
Richer@Richer-pc MINGW64 /f/www/cms (master)
$ git remote add origin https://github.com/Richerjx/cms.git
Richer@Richer-pc MINGW64 /f/www/cms (master)
$ git push origin master
Counting objects: 156, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (153/153), done.
Writing objects: 100% (156/156), 1.21 MiB | 376.00 KiB/s, done.
Total 156 (delta 24), reused 0 (delta 0)
remote: Resolving deltas: 100% (24/24), done.
To https://github.com/Richerjx/cms.git
* [new branch] master -> master
Richer@Richer-pc MINGW64 /f/www/cms (master)
$
5)多次上传会报错,可先删除后再上传
fatal: remote origin already exists.
git remote rm origin
评论 (0)