0

I am working on a Django application (and in Python I'm rather the beginner 😃) that will push some code to the Git repository (any remote).

Everything works fine on my local machine, but here I have the keychain and SSH configured.

However, as soon as the app will go into production, that will not work, as everyone would have to use the same user to push the code (which is not possible unfortunately), or configure ssh for everyone, which also is a no-go.

So far I have managed to create this:

call(["git", "init"])
call(["git", "remote", "add", "origin", request["repo_url"]])
call(["git", "add", "-A"])
call(["git", "commit", "-m", "Initial commit"])
call(["git", "push", "-u", "origin", "master"])

And, as stated above, this works if I push from my local dev machine with configured Git and keychain.

But now, how do I input the password after the push command? Is this even possible?

Thanks for any help :)

2

1 Answer 1

2

Use an url:

call(["git", "push", "https://username:password@host/repo.git"])
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, it works :) although I had to modify slightly the code to set the user.name and user.email in the git config for it to pass correct committer data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.