ProjectInitializationAutomation
ProjectInitializationAutomation copied to clipboard
Username conflict issue affecting git remote add
I found the issue on my Mac machine, with retrieving the username from the .env file. The issue arose because my Github and Mac machine usernames were different.
On the following line in create.py
username = os.getenv("USERNAME")
My Mac machine username was somehow being retrieved instead of the Github username I had set in the .env file. This was causing the command git remote add origin <[email protected]:$USERNAME/$1.git>
to insert the wrong username, causing it to fail.
Renaming the USERNAME to GITHUBUSERNAME in the codebase alleviated the issue.
That is, and in the .env files, the following was changed:
In create.py
username = os.getenv("GITHUBUSERNAME")
In .my_commands.sh
git remote add origin https://github.com/$GITHUBUSERNAME/$1.git
And .env file
GITHUBUSERNAME="<my_username>"
Most probably this is happening because the USERNAME is a OS reserved environmental variable. Like maybe Mac saves your username in a env with the same namespace.
I have created a same script as this to work on every machine
DO NOT WORRY THIS SCRIPT WORKS ON EVERY MACHINE
Link to the project: https://github.com/String-error-404/GIT-and-GTITHUB_automation
if you like the project give a star to the repo and follow me on github