File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,19 @@ def communicate(self):
31
31
cwd = self .cwd ,
32
32
env = self .env
33
33
)
34
- p .expect ('Username for .*: ' )
35
- p .sendline (self .username )
36
- p .expect ('Password for .*:' )
37
- p .sendline (self .password )
34
+
35
+ # We expect a prompt from git
36
+ # In most of cases git will prompt for username and
37
+ # then for password
38
+ # In some cases (Bitbucket) username is included in
39
+ # remote URL, so git will not ask for username
40
+ i = p .expect (['Username for .*: ' , 'Password for .*:' ])
41
+ if i == 0 : #ask for username then password
42
+ p .sendline (self .username )
43
+ p .expect ('Password for .*:' )
44
+ p .sendline (self .password )
45
+ elif i == 1 : #only ask for password
46
+ p .sendline (self .password )
38
47
39
48
p .expect (pexpect .EOF )
40
49
response = p .before
You can’t perform that action at this time.
0 commit comments