Git入门记录

首先需要下载git, Google或百度搜索git官网即可下载,此处不做赘述.

然后打开项目文件夹,鼠标右键选择Git Bash Here.

之后会出现命令行界面,会有你的计算机名称及型号.此时代表git打开成功。

利用cd命令进入到项目文件夹,初始默认在c盘,我的是cd /e/git/projects 这个目录下是我要上传的内容

接下来就是命令:

git add . 添加当前目录下所有内容至暂存区   (如果想移除的话 git reset .)

git commit  -m "content"    ""里填写内容为备注,便于其他人理解你的内容

最后git push origin master

在最后一步如果出现

remote: Resolving deltas: 100% (9/9), done.
remote: error: GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: http://github.com/settings/emails
To https://github.com/xxx/xxx.git
! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'https://github.com/xxx/xxx.git'

我的解决办法是到github的个人设置(Settings)中找到Emails, 将下方的Keep my email address private前面的对号去掉就可

如果遇到

Total 93 (delta 9), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date

可能是传输文件太大,执行一下git config http.postBuffer 524288000就可以了

在github上的第一个项目成功了,随着之后的学习会继续记录的

posted @ 2018-11-01 21:55  Wicosad  阅读(457)  评论(0)    收藏  举报