git命令输出到文件

时间:2017-02-17 04:27:22

标签: git file output

我正在使用Ubuntu OS,我尝试执行git命令,如下所示:

git clone -v https://senuser:xxxx@bitbucket.org/senxxxx/xxxxx.git > /home/ubuntu/output1.txt 2>&1.

但输出显示:

ubuntu@dev:~ [04:24:16]$ more output1.txt 
Cloning into 'xxxxxxx'...
POST git-upload-pack (252 bytes)
ubuntu@dev:~ [04:24:24]$ 

但如果我手动执行命令,我会得到以下内容:

ubuntu@-dev:~ [03:28:36]$ sh testgitpull.sh 
Cloning into 'xxxxxxaws'...
Password for 'https://senuser@bitbucket.org': 
remote: Counting objects: 56, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 56 (delta 18), reused 0 (delta 0)
Unpacking objects: 100% (56/56), done.
Checking connectivity... done.
ubuntu@xxxx-dev:~ [03:28:48]$

有人可以帮助如何获得上述类型的输出而不是2行吗?

1 个答案:

答案 0 :(得分:0)

为什么不使用以下命令?

git clone -v https://senuser:xxxx@bitbucket.org/senxxxx/xxxxx.git &> /home/ubuntu/output1.txt

有关详细信息,请参阅what-does-devnull-21-mean