Let's say I have:
1. github repo https://github.com/user1/repo1
2. And I have gitlab repo (user2)
https://gitlab.com/user2/repo2
What I want to do is programmatically from my script push the latest code from repo1
to repo2
-Let's presume I always use login and password Auth, user1 and user2 have different passwords
-I don't want to save the original commit history of repo1(that's important).
-Author of the commit in repo2 should be user2
It should work something like this:
I run my script(for example pusher.py
), specifying input params:
user1, password1, user2, password2, origin1, origin2, commit_message
And my script
Authorizes as
user1
, pulls code fromrepo1
Logs out and authorizes as
user2
, commits and pushes torepo2
asuser2
How do I do this? May be you can share the list of git commands to do it. Right now I am thinking of
1.Authenticating as user1
, pulling repo, programmatically copying code to another folder.
Logging out as suggested here
git credential-manager delete https://github.com/user1/repo1
2.Authenticating as user2
and committing and pushing to new repo
Is there a better to do this?