How can I `git push` to GitHub on Ubuntu using a single command, without having to type in my email each time?

Issue

I want to git push on Ubuntu via a single command, such as:

echo -e "email\ntoken" | git push origin branchName

git push origin branchName && email && token 

But after the command I have to put in my email:

enter image description here

Solution

You can provide the username once as part of the https git remote address.

First run git remote -vv to get the full, current remote URL.

Then to change your existing remote, you can do a command like:

git remote set-url origin https://[email protected]/yourname/yourrepo.git

where the new part is [email protected] (substitute your github user name) and the rest of the URL should be the same as shown in git remote -vv

Answered By – Dan Bonachea

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published