Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用git使用Ansible的通配符推送所有文件_Git_Ansible_Runtime Error_Runtime - Fatal编程技术网

无法使用git使用Ansible的通配符推送所有文件

无法使用git使用Ansible的通配符推送所有文件,git,ansible,runtime-error,runtime,Git,Ansible,Runtime Error,Runtime,我计划将本地系统“/app/gitfiles”下的所有文件和文件夹推送到本地远程git服务器 下面是我执行的命令: 1. export GIT_SSH_COMMAND="ssh -i /path/to/private/id_rsa -F /dev/null" 2. git init /app/gitfiles 3. ls -qa /app/gitfiles/ . .. CRM.ear .git #Verified that the .git folder got created

我计划将本地系统“/app/gitfiles”下的所有文件和文件夹推送到本地远程git服务器

下面是我执行的命令:

1. export GIT_SSH_COMMAND="ssh -i /path/to/private/id_rsa -F /dev/null"

2.
git init /app/gitfiles

3. 
ls -qa /app/gitfiles/
.  ..  CRM.ear  .git

#Verified that the .git folder got created

4.
git add -a /app/gitfiles/*
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

5.
git commit -m "Adding new files to repo"

6.
git push
如您所见,我希望/app/gitfiles/被添加到git stage@step 4。在本示例中,是CRM.ear文件夹 但不幸的是,它失败了,错误如第4点所示

你能建议一下我的命令第4步有什么问题吗


最终目标是编写一个ansible playbook[可能是ansible git模块]来完成上述任务。

您需要运行一个3.5步骤,如
cd/app/gitfiles/
,然后才能开始执行添加/提交等操作。

除了在正确的文件夹中准备一张cd,不要使用通配符
*
git add
:“*”由shell解释

正确的语法是:

cd /app/gitfiles/ 
git add .

”将添加当前文件夹(其中还包括
.git
存储库目录)中的所有内容。

我建议将4:
git add-a/app/gitfiles/*
改写为
git-C/app/gitfiles/add-a。
虽然这是一个好建议,但并不准确。当*被bash扩展时,git不包括在内,因为它是一个隐藏目录。