youngmon/atlassian-qna huggingface dataset:
using git
Asked by William Thompson:

I have just started using git.  
I have created a repository.  
Then, as I was instructed, I made a "git clone" command which consisted of "git clone" followed by a path.  
I expected this to get the contents of the path and put it into my repository -- meaning the directory I made. This did not happen. What do I do?  
How do I get a local copy of a remote work space for me to work on?


Answers:
author: Jimmy Seddon
body: Hello [@William Thompson](/t5/user/viewprofilepage/user-id/4685138),

Welcome to the Community!

Just to make sure I understand what you have done so far, where did you create your repository? Github? Bitbucket? somewhere else?

The 'git clone' command will make a copy of the repository (remote) on your local machine.

If you already have a directory locally with files in it, that won't work. You will need to either run 'git init' to create the repository locally, or execute the 'git clone' command on an empty directory and then copy the files in after you have created the repository.

I'd recommend checking out the getting started guide here: <https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository>

It might also be worthwhile going back to the beginning of that getting started guide in case you have missed a couple of steps that will be required before you can commit and push changes.

I hope that helps!

-Jimmy


Tags: git

off-topic
"unresolved merge conflicts" due to files created by SourceTree/mercurial
Asked by Leandro Gabales:

```
hg commit -y --logfile C:\Users\LG\AppData\Local\Temp\rdhcyxzm.h2eabort: unresolved merge conflicts (see hg help resolve)Completed with errors, see above.
```

When I attempt to commit, this comes up. The name of the file is always different and it always has a different file suffix. I cannot push because of this, and it's stopping me from updating my repository on Bitbucket.

How does one go about fixing this?

**EDIT:** just adding that I was able to successfully commit/push before this started happening


Answers:
author: Seth
body: The error message you posted is NOT telling you that rdhcyxzm.h2e is causing or part of a merge conflict, it is just a log file. You should check your SourceTree UI for files that have a yellow warning symbol beside them, and resolve merge conflicts in those files.

For more information on what "unresolved merge conflicts" **means**, read:

<http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts>

comments: author: Leandro Gabales
body: The log file only contained the commit message.

In any case, I resolved the stuff marked with yellow "!" warning symbols and the problem was solved.

Thank you for your help.
Is there anyway to support Microsoft's Cloud Based Team Foundation Service with them as a GIT provider
Asked by don burnett:

Here's my normal method for supporting their GIT based repository on a non-Microsoft system.. Can I do a similar thing with Source Tree. I do a lot of code sharing.. Note my client doesn't used stash. I am using Source Tree with Xamarin and Visual Studio online..  

1. First of all, create a hosted TFS account and added a New Team Project + Git

2. Create alternative login credentials since you cannot have an @ symbol in your login info. Follow the Create Team Project and Enable alternative Credentials instructions[here](http://tfs.visualstudio.com/en-us/learn/use-git-and-xcode-with-tfs.aspx)

3. After enabling the alternative credentials open Xamarin Studio and my solution file open as well.

4. Under the Version Control menu item select Publish (Only available with solution file open)

5. Select the Registered Repositiories tab and select Add

6. Enter an appropriate name. Select https protocol.

7. Enter your hosted TFS URL ie. [xxx.visualstudio.com](http://xxx.visualstudio.com).

8. For port, enter 443.

9. The path will be: /DefaultCollection/_git/ + project name (exactly as you typed it including spaces)

10. User will be the alternative username you created in step 2. Click OK on both open windows.

11. You will be prompted to confirm publishing. Select OK.

12. You will then be prompted for your password. Enter you alternative password you created in step 2. If you accidentally enter the wrong password here, you must delete the entry from your key chain. Instructions can be found [here](http://support.apple.com/kb/PH7293)

<https://www.visualstudio.com/>


Answers:
author: Bal?zs Szakm?ry
body: The way to test this:

1. Open SourceTree.
2. Press the "Add Repository" button in the lower left of the Bookmarks part (white background, CTRL+B makes it appear if not there).
3. Switch to the "Add working copy" tab.
4. Browse to the folder containing your code and add it as a bookmark.
5. Check if you can browse the history and commit/push/pull with SourceTree


Tags: git

visual-studio
How can I revert a merge commit in sourcetree
Asked by Oliver Secluna:

Hi,

I work using pull requests and sometimes they need to be reverted. The command line workflow I use is as documented here: [](http://tildedave.com/2012/11/24/reverting-a-github-pull-request.html)<http://tildedave.com/2012/11/24/reverting-a-github-pull-request.html>

Basically I create a new branch, find the merge commit SHA and then run

```
git revert -m 1 SHA
```

In sourcetree there is the 'Reverse commit...' option, which does a git revert but it will not work on a merge commit because it will not use '-m' (see [](/questions/322559/what-exactly-is-reverse-commit)<https://answers.atlassian.com/questions/322559/what-exactly-is-reverse-commit>).

How can I use sourcetree to revert a merge commit?

Thanks


Answers:
author: Bal?zs Szakm?ry
body: If you want to do it in SourceTree, you can only do it with a custom action.

I already created a feature request for this, you can vote for it [here](https://jira.atlassian.com/browse/SRCTREEWIN-1832).

comments: author: lindsayannb
body: Zero reference for the command to enter into the custom action to actually answer the question?


author: Edgar de Graaff
body: Script to run:

```
git
```

Parameters:

```
revert -n -m 1 $SHA
```

(I prefer it not to automatically commit so I can review the changes, hence the -n parameter)


author: lorenzoios
body: Thanks it was helpful for me


Tags: bitbucket-cloud

cloud

git

mac

revert
Interactively rebase always aborting
Asked by akamud:

I'm using SourceTree 1.5.2 for Windows and I'm having problems doing a interactively rebase with edit.

What I'm trying to do is to run the equivalent to:

```
git rebase --interactive 07b...
```

with "**edit** " in a single commit. If I understood correctly, checking the "Amend commit?" checkbox does exactly that, as explained [here](http://blogs.atlassian.com/2014/06/interactive-rebase-sourcetree/).

The problem is that, after I mark any commit to be edited, I get two messages:

The first one is the expected one, SourceTree is running rebase and stopping at the commit:

```
Stopped at 07b... My commit messageYou can amend the commit now, with	git commit --amendOnce you are satisfied with your changes, run	git rebase --continueCompleted successfully.
```

But when I close this window, I instantaneously get a rebase --abort **everytime**.

```
git -c diff.mnemonicprefix=false -c core.quotepath=false rebase --abortCompleted successfully.
```

So my repository goes back to the initial state and I can't rebase editing. I couldn't find any solution so far, I ended up doing this by command line, but I'm wondering if I'm doing something wrong or if this is a bug.


Answers:
author: akamud
body: I have tested this in many other repositories, even other machines, and I still get an abort everytime.
sourcetree can not find git config
Asked by Daniel Schmid:

As soon as I try to open a project in sourcetree on windwos I get the following error

"fatal: unable to access '"C:\\Users\\\<user\>"/.config/git/config': Invalid argument"  

why I sourcetrree loking in the directory and how to chnage that? My global Git config is on  
'"C:\\Users\\\<user\>"/.gitconfig'  

I tried a lot already any help welcome  


Answers:
author: Robert Kapala
body: Hi Daniel,

I had the same issue.

To fix it I opened **Environment Variables** (open **Control Panel** -\> **System** -\> **Advanced system settigns** , tab: **Advanced** , click **Environment Variables...**).

In **User variables for \<user\>** had a variable: **HOME** with value

```
"c:\Users\&lt;user&gt;"
```

Replace the value with value:

```
c:/Users/&lt;user&gt;/
```

Now should work fine!

Cheers,

Robert

comments: author: Linda van Zyl
body: You sir, are a star! I've been having issues with Source Tree not reading my global configuration for some reason and kept creating a local copy of .git that I didn't want.

Adding this Env Variable sorted it out :)


author: ESC_Q
body: How can I solve this issue if I don't have permissions to change system variables or my .gitconfig is not located in the HOME directory?


author: Muthuram Arumuganainar
body: Great. its working fine.


author: karima khirellah
body: Thanks Robert,

It worked fine!


author: Daniel Schmid
body: Hi Robert

Excellent! That worked!

I was searching for months for a solution to that.

Thx again, Daniel


Tags: git
git, sourcetree on osx and "?"
Asked by wab:

Hi!

Have some files that have a "?" in their name and while git handles that correctly on linux and on osx command-line, sourcetree mentions those files as unversioned and complaints when adding these files that "pathspec did not match any files for git".

I'm running the built-in git version of the latest sourcetree on latest osx (10.9.4).

Cheers


Answers:
author: Seth
body: It's generally a bad idea to use special characters in file names, as support can be unpredictable with other operating systems and software (as you have discovered with SourceTree).

However, if the OS and Git both support the character, SourceTree ought to as well. You should file a bug report at [](http://jira.atlassian.com)[jira.atlassian.com](http://jira.atlassian.com), then add a link to the bug here as an answer.


author: o.bou
body: It's also happening to me with Spanish character "?".

I've created the following issue:

<https://jira.atlassian.com/browse/SRCTREE-3012>

comments: author: Seth
body: Thanks for taking the initiative on that, and for posting back here.


author: Antoine C?ur
body: I've probably created a duplicate: <https://jira.atlassian.com/browse/SRCTREE-3739>


author: wab
body: Sourcetree works fine if the file is created in osx but if the file was created in linux and pulled to osx, this situation happens. Currently, I've renamed the file and won't use special characters for now.
How to change the username on the login form when cloning a repository on Source tree
Asked by Alexandre Roba:

How to reproduce:

-On windows start Source tree

-Click on Clone/New

-Paste a Git Repo URL on the destination then click on the Destination path Textbox

-The authenticate form will show up

-Fill in a WRONG username (In my cas it was an invalid email address)

-Provide a password and check remember

-Find out it was not the right email address by clicking on Login....

Now every time I try to clone the same repo the authenticate Form shows up with the WRONG email address grayed out. I can only provide a different password. I cannot change the Username!!!!

I try to restart Source tree, UNInstall Source tree, but all previous settings stay and the Invalid Email address is still there after a full Uninstall/Reinstall....

How can I remove this and provide another Username?

Thanks for the help


Answers:
author: mbeining
body: Actually I found the solution!

In the source tree installation folder (in my case it was under "C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree") there are two files named "passwd" and "userhosts". There your bad names are saved. I closed SourceTree, deleted those two files, restarted SourceTree and then the fields were blank again =D

comments: author: Fernando Vega Morales
body: worked 100% thanks a lot


author: Bal?zs Szakm?ry
body: 1. Open the Options dialog from the Tools menu.
2. Change to the Authentication tab.
3. Edit your details for the server you are cloning from.


author: Angela Lengkeek
body: None of these suggestions helped solve the problem. The problem exists in 2016 still.

comments: author: mbeining
body: Problem still exists in 2017, at least on Windows...


author: Spencer O'Reilly
body: I found the "remembered" bad username under SourceTree \> Preferences \> Network. Just removed that and now I can enter my own username again.
Why does a deleted, local repository come back?
Asked by Mark Mark:

I have a folder of SQL files I want to track changes on. In learning the software I messed things up and just want to delete the repository and start over.

I've tried deleting the bookmark and deleting the folder (I had created a backup), but when I create a new repository of that folder it still remembers the old branches/changes and everything from the repository I thought I deleted.

How do I REALLY delete the repository?

Thanks!


Answers:
author: Seth
body: There is a hidden directory named ".git" That stores all the repository data. When you backed up the folder, that directory would have been included.


author: Mark Mark
body: Never mind. It's a git issue not a SourceTree issue.


Tags: delete

repository
Sometimes searching "file changes" returns seemingly non-relevant results.
Asked by Tyler Harder:

I've noticed that often when I use the search toolbar to search for a file via "file changes", I get results that don't have the file in the commit. Does anyone know why this occurs?


Answers:
author: Bal?zs Szakm?ry
body: It is probably finding files which contain the string/file name you are searching for. e.g. if you search for the name of a a header file in C++ code, you would find all .cpp files using the header.


author: Tyler Harder
body: Hrmm, yes must be. Some of the strings I've tried searching didn't seem to be included in the result files in any form, but if no one else is experiencing this, I may have missed something. I'll have a second look in more detail if it comes up again. Thanks.
How to trigger a Crucible Code Review from SourceTree
Asked by Ian Davidson:

Pardon my ignorance, still a noob trying out Crucible and SourceTree, but it seems SourceTree's Custom Actions function might be able to be used to trigger a Crucible Code Review? Is there any documentation or can anyone suggest how this can be done? TIA

Ian


Answers:
author: Dave Theodore [Coyote Creek Consulting]
body: Cool. Good luck! Be sure and read all of the documentation. If you have users checking in code with one username and using Fisheye with another username, you'll need to make use of Fisheye's "User Mapping" feature to deal with those cases.


author: Dave Theodore [Coyote Creek Consulting]
body: You should be able to use the [Smart Commits feature in Fisheye/Crucible.](https://confluence.atlassian.com/display/FISHEYE/Using+smart+commits#Usingsmartcommits-IntegrationwithCrucible) It will require that your Fisheye/Crucible version support Smart Commits and that your tools admin have the feature enabled.

comments: author: Ian Davidson
body: Ah, thanks Dave, I was mislead by the SourceTree doco so looking in the wrong place :-(. Found the documentation for Smart Commits - that should do the trick!
Merge questions
Asked by Delette Collins:

New Git users here. We have been going about things incorrectly and I am trying to clean things up. We have a temp branch and a master branch. Changes have been made and pushed on both branches. Ultimately I would like to get everything from the temp branch over onto the master branch and then I remove the temp branch so I can implement GitFlow. In source tree what branch should be checked out when I click merge and how can I ensure that I am merging the temp branch to master and not vice versa?


Answers:
author: Johannes Kilian
body: > In source tree what branch should be checked out when I click merge and how can I ensure that I am merging the temp branch to master and not vice versa?

You always need to be on the branch where you **want to merge your changes into** - in your case: "merging the temp branch to master" means; checkout master and merge the changes from branch *temp*. That's not a question of the git-client (i.e SourceTree) but a general question on git.
>
> Ultimately I would like to get everything from the temp branch over onto the master branch and then I remove the temp branch so I can implement GitFlow

Change the current branch to master in git on Stackoverflow seems to give the answer here.

comments: author: Johannes Kilian
body: > You always need to be on the branch where you **want to merge your changes into**

Consider yourself being the branch to be merged into: do you want to fetch the changes on your own - or do you want to be forced by another branch to involve it's changes? I think you prefer deciding on your own, which changes should be incorporated rather than being forced to involve the changes...

Therefore: While merging, you have to be on the branch where you want to merge the changes from another branch into.
How to recover from making changes in master instead of development branches?
Asked by theTechnaddict:

I've been using sourcetree with gitflow, my first steps with these tools.

In error I made and commited changes in the master branch which is now 'ahead' of the develop branch.

By ahead I simply mean that the files listed under master have changes in them that have never been in Develop - hence I am worried that if I now develop a feature branch from develop I am going to be doing so on a version that is less developed than the master and risk losing those changes when develop later gets merged to master on completing a new release.

The changes I made were good and I want to preserve them, and get back to creating new features as branches from the development branch, later merging them into the master as new releases.

What is the best way to get things back on track?


Answers:
author: Alejandro Conde Carrillo
body: I think you could:

1. Checkout your development branch.
2. Merge master to dev. Resolve conflicts if any.
3. commit changes to dev branch (now containing changes from master).

comments: author: theTechnaddict
body: Thanks Alex,

I am unclear about checking out... This page in the manual talks about checking out from a remote source to the local repository..

[](https://confluence.atlassian.com/display/BITBUCKET/Checkout+a+branch+into+a+local+repository)<https://confluence.atlassian.com/display/BITBUCKET/Checkout+a+branch+into+a+local+repository>

Is this what you mean?

My first reaction was to switch to the develop branch and hit the checkout button on the toolbar. It requested that I select the branch that I wish to change my working tree to... Is this what you mean?

Many thanks for your patience with somebody who is learning.


author: Seth
body: You should also read chapters 1-3 of the [Git Book](git-scm.com/book).


author: Seth
body: In SourceTree, you can right-click on the branch name in the left pane, and select "Checkout...", or just double-click on it.


author: theTechnaddict
body: Sorted - thanks to both
sourcetree undo push
Asked by mutow:

Hi.

I accidently pushed something into the wrong branch. Can I undo that push?

Is it right-click on the last valid commit, and choosing "reset branchname to this commit"? Or another option?

Thanks.


Answers:
author: Bal?zs Szakm?ry
body: [This thread](/questions/317478/reset-head-in-source-tree) has probably all the steps you need.


author: Seth
body: To clarify, did you just **commit** something to the wrong branch (easy to fix), or did you also **push** it to a remote (fixable, but will cause problems for teammates)?
Using git on remote server
Asked by Daniel Salamon:

Hi,

Our company uses a local server, what every developer uses every day. We SSH to it and write the code there.

I would like to ask, if is it possible to use SourceTree to connect to this development server through SSH to apply git commands there?

Thanks,

Daniel S. (Mito Europe Ltd.)


Answers:
author: Seth
body: It does really matter. SourceTree only runs local Git commands. Your devs could attempt to use SourceTree (or any other local Git client) by mounting their home directory on their local machine. However, many people have had significant problems with this type of setup, because Git is designed to work with truly local data.

Some questions I've participated in regarding this type of setup:

[](/questions/252195/use-a-git-running-on-a-remote-server)<https://answers.atlassian.com/questions/252195/use-a-git-running-on-a-remote-server>

[](/questions/275021/fatal-unable-to-write-new-index-file)<https://answers.atlassian.com/questions/275021/fatal-unable-to-write-new-index-file>

[](/questions/278410/pulling-from-remote-github-to-server)<https://answers.atlassian.com/questions/278410/pulling-from-remote-github-to-server>


author: Daniel Salamon
body: "SourceTree only runs local Git commands." :(  
Thanks Seth!


author: Daniel Salamon
body: No, every developer has it's own account, and under the own home directory the own working copy. And we can use this server from outside. But this dowsn't really matter.

Is there a way to use this remote server from my local PC's SourceTree?

We tried *ungit* as an alternative, but it's not so reliable so we need a solution that could connect to this remote development server and use git there. Currently we can only use git commands from the terminal.


author: Seth
body: So you are all working on and editing a single copy of the code? What happens if two people work on the same file at the same time? What do you do if a developer needs to work outside the office, or if part of your networking equipment fails?
Workflow when creating a new repository
Asked by Normanbird:

Hi

Im using Git Tortise GUI on Windows to create then push new repositories to Bitbucket. I always have to create the repositories on Bitbucket first then take the link and us it to create a new remote in Tortise.

I was wondering if I there is a way to simply create the new repository and push it to Bitbucket and have it automatically created in Bitbucket? Is this possible with Tortise

And if not, is it possible if I switch to Sourcetree?

Or does one have to ALWAYS create the repo FIRST at [Bitbucket.com](http://Bitbucket.com) prior to pusching the local repo?

thanks


Answers:
author: TimP
body: Hi Norman,

Yep! You can create repositories straight from SourceTree. Just click the little globe icon on the Clone Repository dialog, add your Bitbucket credentials (if you haven't already) and then click "Create New Repository".

cheers,

Tim

comments: author: Normanbird
body: just tried installing on windows vista and it would not do so. Is there a version for windows vista? Lots of people still use Vista. its not that old. :-)


author: TimP
body: Sorry Norman, Windows 7 and up: [](http://www.sourcetreeapp.com/faq/#ui-accordion-2-header-0)<http://www.sourcetreeapp.com/faq/#ui-accordion-2-header-0>

It's also supported on OS X FWIW.


author: Normanbird
body: OK. I have vista and or Ubuntu. I do not believe I have ever seen another windows app that does not support Vista.I will have to just keep Tortoise Git then. No problem. I was just looking into it. Peace.


author: Seth
body: "lots of people still use Vista" - [not really](http://en.wikipedia.org/wiki/Usage_share_of_operating_systems). If you get an opportunity to upgrade to Windows 7 without spending too much money, I highly recommend it.


author: Seth
body: As far as I know, you must create the repository in Bitbucket first, because the URL to push to only exists after the repository is created.


Tags: bitbucket-cloud

cloud

git

repository