繁体   English   中英

从本地推送到远程时,文件夹为空

[英]Empty folder when pushing from local to remote

我在VS Code内部有一个项目,该项目在本地使用git,并且所有内容都已提交/最新。

现在,我想将所有内容推送到服务器,以便在本地工作时可以更新服务器上的文件。

我已经在服务器上设置了git repo并从vs code project终端连接了它,但是当我进行一次推送时,它说一切都是“最新的”,并且服务器上的文件夹为空,其中仅包含.git文件夹。

我想将所有项目文件传输到服务器上的文件夹,该怎么做?

现在我正在做:

git push origin --all 

我知道Everything is up to date

我也尝试做:

git add.
git commit -m "commit message"

但是我明白了

on branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

如何将所有本地git文件发送到服务器git repo?

除了git statusgit remote -v,别忘了您通常会推送到仓库

这意味着:远程目标应仅具有一个.git文件夹,其中包含从本地工作站接收到的压缩文件。

您不会在此处看到任何文件(除了Git参照文件)。

让我们从VSCode终端尝试一下。

1)将当前工作目录更改为本地存储库(您的项目目录)。

2)暂存文件以提交到本地存储库。

git add .
# Adds the file to your local repository and stages it for commit.

3)提交您在本地存储库中暂存的文件。

git commit -m "Your commit message here"
# Commits the tracked changes and prepares them to be pushed to a remote repository. 

4)将本地存储库中的更改推送到远程服务器上托管的存储库(示例:GitHub)。

git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM