Problem scenario
You do not want to copy a branch to create a new one. How do you create a branch of a repository that has no branches?
Solution
You must know the relevant organization name of the Git repository and the name of the repository itself. Do these changes:
- Change "acme" to the organization name
- Change "goodrepo" to the repository name of your choice.
- Change "jdoe" to the user for GitHub
- Change "securepassword" to the password for the above user
user=jdoe
password=securepassword
ORGNAME='acme'
REPONAME='goodrepo'
git clone https://github.com/$ORGNAME/$REPONAME.git
cd $REPONAME
echo "This file was added automatically." > file3.txt
git add file3.txt
git commit -m "Added a file to the repository."
git push https://$user:$password@github.com/$ORGNAME/$REPONAME.git