[BUILDTOOLS-26] Set git author locally instead of globally Created: 05/Dec/14  Updated: 16/Jan/24  Resolved: 16/Jan/24

Status: Resolved
Project: BuildTools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: GunfighterJ Assignee: GunfighterJ
Resolution: Fixed Votes: 8
Labels: None

Issue Links:
Duplicate
is duplicated by BUILDTOOLS-491 hijacks global git config Resolved
is duplicated by BUILDTOOLS-593 Don't intrusively set global git name... Resolved

 Comments   
Comment by md_5 [ 10/Jun/22 ]

Thank you. Unfortunately the patch is not complete as it will break older versions, but it is a helpful starting point and we can probably handle it from there.

Comment by oddlama [ 10/Jun/22 ]

Sorry, I didn't mean to offend you. I've implemented a fix for this. Unfortunately, I see no way to contribute to the project without revealing an uncomfortable amount of personal information when signing the CLA. Therefore I've opted to release the relevant patches into the public domain under the CC0 license. The patch is tiny, but requires a simultaneous change in BuildTools and Spigot. So I'll just leave them here.

BuildTools patch:

diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java
index e6c5e91..56b936d 100644
--- a/src/main/java/org/spigotmc/builder/Builder.java
+++ b/src/main/java/org/spigotmc/builder/Builder.java
@@ -240,23 +240,6 @@ public class Builder
             System.exit( 1 );
         }-        try
-        {
-            runProcess( CWD, "git", "config", "--global", "--includes", "user.name" );
-        } catch ( Exception ex )
-        {
-            System.out.println( "Git name not set, setting it to default value." );
-            runProcess( CWD, "git", "config", "--global", "user.name", "BuildTools" );
-        }
-        try
-        {
-            runProcess( CWD, "git", "config", "--global", "--includes", "user.email" );
-        } catch ( Exception ex )
-        {
-            System.out.println( "Git email not set, setting it to default value." );
-            runProcess( CWD, "git", "config", "--global", "user.email", "unconfigured@null.spigotmc.org" );
-        }
-
         try
         {
             runProcess( CWD, "java", "-version" ); 

Spigot patch:

diff --git a/applyPatches.sh b/applyPatches.sh
index a26ea35e..29e5bcf9 100755
--- a/applyPatches.sh
+++ b/applyPatches.sh
@@ -15,6 +15,8 @@ applyPatch() {
     fi
     cd "$basedir/$target"
     echo "Resetting $target to $what..."
+    git config --includes user.name &>/dev/null || git config user.name unconfigured
+    git config --includes user.email &>/dev/null || git config user.email unconfigured@null.spigotmc.org
     git config commit.gpgSign false
     git remote rm origin >/dev/null 2>&1
     git remote add origin ../../$what >/dev/null 2>&1 

 

Comment by md_5 [ 09/Jun/22 ]

We're a free and open source project. If the issue is bothering you then you can contribute a fix via a pull request.

Comment by oddlama [ 09/Jun/22 ]

How can it be that this is still an issue almost 8 years after creation? I also forgot to change it back several times, which is really upsetting. It's absolutely unacceptable that buildtools sets something in my global git configuration.

It seems like people stumble over this again and again. What exactly is blocking progress on this issue? Do you require any help to solve this?

Comment by Ben Mitchell [ 27/Nov/20 ]

I might be wrong, but surely we can just use git over https, thus not requiring any .gitconfig. I just found out that I'd been committing to my uni projects under this unconfigured email; kinda mad

Comment by md_5 [ 09/Dec/14 ]

Really should be done in applyPatches, since that is only where it is needed afaik.

Generated at Sat Mar 22 23:59:59 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.