<p>This is not supported by Azure DevOps pipelines yet. Microsoft will provide it soon. Will update this post once they made it available. </p>

<p>Pretty straight forward way to get last commit user in Bash:<br>
<code>git log -1 --pretty=format:'%an'</code> </p>

CC BY-SA 4.0
2019-06-17T05:22:17.217Z
2019-06-17T05:22:17.217Z
sithumc
<p>I have an Azure DevOps pipeline build configuration which builds automatically with the master branch. I want to access the <strong>GitHub user</strong> or username who committed last.  </p>

<p>If I access variables <code>$(Build.QueuedBy)</code> and <code>$(Build.RequestedFor)</code> in a build that I triggered manually from the portal, I get the outputs as <code>Sith</code> and <code>Sith</code> respectively.  </p>

<p>But when I pushed code to master and triggered automatically with CI, I get outputs for the variables as <code>Microsoft.VisualStudio.Services.TFS</code> and <code>Microsoft.VisualStudio.Services.TFS</code> respectively. </p>

<p>I can access all <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&amp;tabs=yaml#buildclean" rel="nofollow noreferrer">other variables</a> like <code>$(Build.DefinitionName)</code> and <code>$(Build.BuildNumber)</code><br>
 in all the cases without any issues.  </p>

<p>How to get Github username variable as <code>Sith</code> instead of <code>Microsoft.VisualStudio.Services.TFS</code>?</p>

CC BY-SA 4.0
2019-06-10T08:28:22.967Z
Can we get this done using bash if this is not supported by pipelines by default?
sithumc
<azure-devops><azure><github><azure-pipelines>
How to get Github username variable in Azure DevOps build pipeline?
sithumc
# How to get Github username variable in Azure DevOps build pipeline?

(Asked by: username_0 on 2019-06-10)

I have an Azure DevOps pipeline build configuration which builds automatically with the master branch. I want to access the **GitHub user** or username who committed last.

If I access variables `$(Build.QueuedBy)` and `$(Build.RequestedFor)` in a build that I triggered manually from the portal, I get the outputs as `Sith` and `Sith` respectively.

But when I pushed code to master and triggered automatically with CI, I get outputs for the variables as `Microsoft.VisualStudio.Services.TFS` and `Microsoft.VisualStudio.Services.TFS` respectively.

I can access all [other variables](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#buildclean) like `$(Build.DefinitionName)` and `$(Build.BuildNumber)`  
in all the cases without any issues.

How to get Github username variable as `Sith` instead of `Microsoft.VisualStudio.Services.TFS`?

**Tags:** azure-devops, azure, github, azure-pipelines

> **Comments:**
> **username_0**: Can we get this done using bash if this is not supported by pipelines by default?  

---

## 1 answers

### Answer by username_0 on 2019-06-17. Score: 0 | Accepted answer

This is not supported by Azure DevOps pipelines yet. Microsoft will provide it soon. Will update this post once they made it available.

Pretty straight forward way to get last commit user in Bash:  
`git log -1 --pretty=format:'%an'`


---

