我正在github上工作,共享一個存儲庫。如何將文件添加到git存儲庫?
我採取了以下措施:
$ git clone https://github.com/Company/repos
Cloning into repos...
Username:
Password:
warning: You appear to have cloned an empty repository.
(是的,我知道的回購是空的,我應該將文件添加到它,但不能:)
$ cd repos
$ echo hello > README.txt
$ git add README.txt
[no output]
$ git commit -m "commit"
[master (root-commit) 824324d] commit
Committer: User <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 README.txt
(。因此,該文件似乎是在)
現在我做:
$ git push
Username:
Password:
Everything up-to-date
沒有內容上傳到存儲庫!如果我再次克隆它,文件不在那裏。
編輯:關注的人的請求:
$ git add README2.txt
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: README2.txt
#
README.txt是一個現有的非空文件,還是您嘗試通過'git add'創建它? – marionebl
@marioebl它是一個現有的文件,我創建它。 – kloop
你可以在'git add'之後加入'git status'的輸出嗎? – marionebl