-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
32 lines (23 loc) · 1.1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 如何使用git命令,这里使用how_to_use_git
# 创建一个目录,比如how_to_use_git
mkdir how_to_use_git
# git初始化
cd how_to_use_git
git init
# 创建一个文件,比如添加README
touch README
# commit 创建的README 新的文件需要add 更新文件只需要commit即可
git add README
# 提交所有更新和add的文件
git commit -m 'commit README'
# 提交指定文件, git commit 文件 -m 'commit README', 如:
git commit README -m 'commit README'
# 至此一直为本地操作, 需要创建一个远程repo, 并push刚才的commit
# origin 可以为其他的 比如sb, 第一次需要git remote add, 之后只需要git push
# 需要先在github的网站上创建how_to_use_it, 否则git push -u origin master失败
git remote add origin https://[email protected]/username/how_to_use_git.git
# 网上有的是采用下面的方式 但是在git push -u origin master这一步总是连接不上错误
# git remote add origin [email protected]:uerbin/how_to_use_git.git
git push -u origin master
# 输入用户名和密码
# 现在repo在github上创建成功, 同时包含一个文件 README