我正在学习Git,我做了教程(如this one)所说的一切,但无法弄清楚问题是什么。
以下是我遵循的步骤:
首先初始化回购:
MyThReYas-MacBook-Pro:~ MyThReYa$ mkdir serraproj
MyThReYas-MacBook-Pro:~ MyThReYa$ cd serraproj
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git init
Initialized empty Git repository in /Users/MyThReYa/serraproj/.git/
MyThReYas-MacBook-Pro:serraproj MyThReYa$ ls
MyThReYas-MacBook-Pro:serraproj MyThReYa$ ls -a
. .. .git
然后添加文件并提交文件:
MyThReYas-MacBook-Pro:serraproj MyThReYa$ ls
index.html
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git add index.html
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: index.html
#
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git commit -m"this is a try"
[master (root-commit) 4acb983] this is a try
1 file changed, 87 insertions(+)
create mode 100644 index.html
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git status
# On branch master
nothing to commit, working directory clean
MyThReYas-MacBook-Pro:serraproj MyThReYa$ git status
然而,我在远程服务器上的网站上看不到该文件 我错过了什么?
答案 0 :(得分:3)
我没有看到任何git push
。
如果您没有推送到您网站所在的远程服务器,则无法看到您在本地提交的内容 那将是这样的:
cd ~/serraproj
git remote add origin /url/to/your/server/repo.git
git push -u origin master