Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -996,5 +996,45 @@ public function getCommitData($commit)

return $data;
}

/**
* Set the user name
* `git config user.name %user_name`
* @param string $user_name
* @return self
*/
public function setUserName($user_name)
{
$this->begin();
exec('git config user.name "' . $user_name . '"');
$this->end();
return $this;
}

/**
* Set the user email
* `git config user.email %user_email`
* @param string $user_email
* @return self
*/
public function setUserEmail($user_email)
{
$this->begin();
exec('git config user.email "' . $user_email . '"');
$this->end();
return $this;
}

/**
* Set the user name and email
* @param string $user_name
* @param string $user_email
* @return self
*/
public function setUserNameAndEmail($user_name, $user_email)
{
return $this->setUserName($user_name)
->setUserEmail($user_email);
}

}