TheEvergreenStateCollege / upper-division-cs-23-24

A Course in Data Structures & Algorithms, Purposeful Web Engineering, Software Construction
https://theevergreenstatecollege.github.io/upper-division-cs/
MIT License
9 stars 4 forks source link

Add config steps as GitPod prebuild #32

Open learner-long-life opened 1 year ago

learner-long-life commented 1 year ago

Currently the following steps needed on GitPod to commit and push are

/workspace/upper-division-cs/scripts/git-config.sh
export GIT_EDITOR=code
git checkout -b <branch name>
git add .
git commit -m "<your message>"
git push

If you commit changes before running the git-config.sh script, you have to amend your last commit before pushing

/workspace/upper-division-cs/scripts/git-config.sh
git push
learner-long-life commented 1 year ago

@WinstonShine is there any way to use GitPod pre-builds or any other feature to improve the situation above? Thanks.

crowllx commented 1 year ago

@WinstonShine is there any way to use GitPod pre-builds or any other feature to improve the situation above? Thanks.

Yes I believe we could have the git-config script run as a pre build task by modifying the .gitpod.yml file. I can take a look at how to do that. Also if users have linked their gitpod and github accounts the git-config script should not be necessary

learner-long-life commented 1 year ago

Thanks.

Also if users have linked their gitpod and github accounts the git-config script should not be necessary

That's what I was hoping, but I still encounter frequent email privacy errors preventing pushes to github. I'll keep looking at it.

crowllx commented 1 year ago

I don't think having the git config script run as part of building the workspace would work very well since we don't want to track git-config.sh. I have not been able to get git to stop tracking scripts/git-config.sh without running git rm --cached scripts/git-config.sh. But this removes it from the remote on next push while keeping the file locally.

I have not experienced this problem myself and I'm currently unsure on how to approach this issue.

learner-long-life commented 1 year ago

Thanks Winston. I think if your primary GitHub email is set as a privacy email address then you may not have this problem.  I have a very hacky solution, feedback is welcomeCommit a file called “privacy.csv” with every username and email address and use bash, cut, and grep to extract the right privacy email address This is a generic git-config.sh that we can commit and keep tracking. I don’t believe any of privacy.csv is sensitive, and it’s already available to the public.  Sent from Yahoo Mail for iPhone

On Thursday, October 5, 2023, 7:28 PM, WinstonShine @.***> wrote:

I don't think having the git config script run as part of building the workspace would work very well since we don't want to track git-config.sh. I have not been able to get git to stop tracking scripts/git-config.sh without running git rm --cached scripts/git-config.sh. But this removes it from the remote on next push while keeping the file locally.

I have not experienced this problem myself and I'm currently unsure on how to approach this issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

crowllx commented 1 year ago

@learner-long-life I was able to successfully get a github privacy email address to be the git commit email by default by adding a gitpod env variable at https://gitpod.io/user/variables I think you can do this in the workspace as well by using the cmd gp env VAR=val. But either way it will require a workspace restart. Also from what i can tell listing the git config settings using git config -l still showed my primary email address, yet once i made a commit and checked the log, my privacy email address was shown instead. the two envs I added were

GIT_AUTHOR_EMAIL
GIT_COMMITTER_EMAIL

You can add a scope of */* and I believe that should add those vars for all projects opened in gitpod. Does this seem like a solid solution to this issue? It's something each user would have to configure if they are experiencing this issue.

learner-long-life commented 1 year ago

Thanks @WinstonShine this sounds like the right way to do it. Restarting the workspace is not a big deal. Can you update this doc and Step to include your method? https://github.com/TheEvergreenStateCollege/upper-division-cs/blob/main/dsa-23au/SoftwareSetup.md#7-set-your-git-config-email

This will simplify using GitPod in the future.