How to run and handle bash commands in python?

I have python app and want to clone git repo. I need to write "git clone", enter "username" and "password". How to do it?

git clone https://github.com/user/awesomerepo.git
username: login
password: password

upd: I want to clone private repos and because I rly need to input usr/pass :)

Answers


If you really want to clone via the Git CLI through Python like this, you could use the subprocess module (see Calling an external command in Python) to issue a command like:

git clone https://user:password@github.com/user/awesomerepo.git

See How to give username and password when do "git clone git@remote.git"?.

You are probably better off using a dedicated Git interaction library for Python, though. See Python Git Module experiences?.


Need Your Help

Ruby on Rails equivalent to actionscript

ruby actionscript ruby-on-rails-4

i have the below actionscript and looking for the equivalent ruby on rails code to do the same job.

Java - See if a string contains any characters in it

java regex string validation character

The problem i'm having is when i check to see if the string contains any characters it only looks at the first character not the whole string. For instance I would like to be able to input "123abc"...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.