我试图在GitHub上添加一个分支到主分支,并将一个文件夹推到该分支上。

分支的文件夹结构看起来像- SocialApp/SourceCode/DevTrunk/SocialApp和所有源代码文件都在最后一个文件夹中。

我正在使用以下Git命令:

git add *
git commit -m with the message
git push

这只是将第一个文件夹“SocialApp”推到GitHub上,而忽略了文件夹内的文件夹SourceCode。我怎么解决这个问题?


当前回答

设置

本地服务器上的本地存储库 客户端通过局域网连接到本地服务器

更新(2020年9月):使用文件夹名/\*代替文件夹名/\\*:

git add foldername/\*

为了到达服务器…

git commit -m "comments..."
git push remote_server_name master

大多数情况下,用户会将remote_server_name指定为origin…

git remote add remote_server_name username@git_server_ip:/path/to/git_repo

其他回答

如果您想递归地添加一个目录和其中的所有文件,请转到要添加的目录所在的目录。

$ cd directory
$ git add directoryname

从top directory调用“git add *”和“git add SocialApp”都应该递归添加所有目录。

可能你在SocialApp/SourceCode/DevTrunk/SocialApp中没有文件,这就是原因。

尝试调用touch SocialApp/SourceCode/DevTrunk/SocialApp/。临时的”(并检查。gitignore),然后再次尝试git add。

如果子目录被忽略,检查.gitignore文件。

然后再试一次

git add --all
git commit -am "<commit message>"
git push

我也有同样的问题,我没有。gitignore文件。我的问题用下面的方法解决了。这占用了所有子目录和文件。

git add <directory>/*

设置

本地服务器上的本地存储库 客户端通过局域网连接到本地服务器

更新(2020年9月):使用文件夹名/\*代替文件夹名/\\*:

git add foldername/\*

为了到达服务器…

git commit -m "comments..."
git push remote_server_name master

大多数情况下,用户会将remote_server_name指定为origin…

git remote add remote_server_name username@git_server_ip:/path/to/git_repo