git: fatal: detected dubious ownership - git-for-windows

I work with a new Windows installation and the same folder on my network share (NAS System).
After installing git and tortoisegit I tried to connect to the git repository, but I always get this error. What has changed is the server and not the user.
I have run
git config --global --add safe.directory '*'
But that changes nothing.
How can I fix this?
Where can I set the variable
GIT_TEST_DEBUG_UNSAFE_DIRECTORIES=true

This happens when a repo was cloned by a different user than your current user. In my case, I've encountered this issue after reinstalling windows, but using previously cloned git repositories (on a separate partition).
Right-click repo folder, properties, security, advanced.
Click "Change" on the Owner line.
Find your user (advanced..., find now, select your user). Confirm.
On the change screen, enable "Replace owner on subcontainers and objects".
That should fix the error.
If you intend to use more than one user on a cloned repo, then I'd follow git instructions to add the exception.

Related

Cannot clone Git repository into sourcetree, Login screen keeps appearing

In BitBucket, when I select clone into source tree, the URL is of format
Sourcetree opens with details to clone, but keeps asking for my login details no matter how many times I enter them.
https://myname#bitbucket.org/mygroup/myrepository.git
I have no problems on a different computer ( also Windows 10 )
I have tried upgrading SourceTree and Reinstalling Source Tree
I have tried System Git and Embedded Git and reinstalling both Git
I can clone Mercurial repositories
At the Dos prompt I can type
git clone https://myname#bitbucket.org/mygroup/myrepository.git
I get a message
fatal: HttpRequestException encountered
An error occurred wihe sending the request
then it asks for my password
then it proceeds with the clone
However in sourcetree the repository shows that there are more branches to pull.
I am unable to pull these branches
When I go to the Tools->Options->Authentication tab I can see myname#bitbucket.org as an Account.
If I try to add myname#mydomain.com.au I get
Authentication failed
Invalid URL: The hostname could not be parsed.
Atlassian community
"The only thing that worked for me was navigating to C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree and removing the passwd file."
Had the same problem , but on MacOS. Just for completion of the answer I will add that on MacOS the passwords are stored in the KeyChain Access and they need to be deleted from there.

New git init broke connection to the files?

I was trying to push my code (ruby on rails) stored in GitLab to production. As it didn't work, I tried to check git repository and accidentally created a new one through project/repo$ git init.
After that I got a message about Initializing a new repository.
According to other solutions for accident git init, it wouldn't be a problem if I initialized a new repository in already existing one, but in this case I would get the Reinitializing existing repository message, which I didn't get. So should I just delete the repository via rm -rf .git? According to this I accidentally started a new git init on an existing git project, what do I need to get it back to normal?, it will do me no good, or it might be different situation?
I have very little technical knowledge, so if you could explain "for dummies" that would be great!
Update: I deleted the repository and everything works now.
What the full message about "initializing a new repository"? In short, yes all git related files are stored in the .git directory so if you delete it you can start fresh. That sounds like a good idea considering that you won't loose anything yet.
Note that git init only sets up the repo to commit. You still need to make an initial commit in order to push to your remote on GitLab. You do this via git's commit command.

Question marks in project navigator Xcode 5

i just updated to Xcode 5 and my project is using GIT, after update completed suddenly question marks appear in project navigator file near each file.
when i am trying to Commit i don't see what files have been changed, i cannot pull also
and when i am trying to push it gives :Push Success" message but the repository on GitHub don't updated.
You probably did not set up your git repository properly. There are ways of adding external git repositories, but they tend not to work well for github (in my experience) and always lead to these sorts of issues.
If you want to set up a remote git repository through github on XCode these are the steps you should take.
Make the repository on github. Make sure to add the .gitignore file for Objective-C.
Clone the repository.
Go to XCode, press "create new project"
Create the project in the folder you cloned the repo to. I always name it the exact same thing, but I don't know if that is necessary.
Make sure not to select create local git repository.
This will definitely create a project that is under version control by a remote git repository hosted on github.
Quick fix is to Create or Save the new project 'outside' the directory (say Desktop) that is not linked to your github/bitbucket

Rails: Rubymine: GitHub

I can't seem to figure out how to commit my files to GitHub.
I am using RubyMine 4.5 on the MAC
I have git set up locally
I have a private account on GitHub
From the RubyMine Preferences, I have my GitHub credentials properly set up (and acknowledged as such by RubyMine), but it did not give me an option to select a repository on GitHub.
How do I commit file to the GitHub repository? There are too many CVS and Git menu items in RubyMine.
PS: I've read the online help sections (the only thing available to me), and I followed the instructions in the GitHub integration, but the directory I'm trying to commit is failing to push to GitHub, with RubyMine telling me that there was nothing to commit. This is the first time I use RubyMine for GitHub. Nothing about this on StackOverflow.
Okay, I think I've recreated your situation locally and it appears that RubyMine has terrible support for managing remotes. If you create a Git repository locally, then (separately) create a repository on GitHub, there's no obvious way to marry the two from within RubyMine.
Basically, you need to set up GitHub as a remote for your local repository from the shell, and once that's done then RubyMine will be able to push as normal.
Please note that the below instructions assume you want to overwrite your GitHub repository with the full history from your local repository -- If your GitHub repository has data that you do not want to lose, do not execute these commands! See Below.
Open up Terminal:
cd /path/to/my/project/root
git remote add origin https://github.com/yourusername/yourrepo.git
git push -u origin +master
Now, RubyMine should be able to push to your GitHub repository via VCS > Git > Push
If your GitHub repository has already been committed to and you don't want to lose those changes, you'll need to either create a new GitHub repo or clone your GitHub repo into another folder and merge your local repository into the clone.
This can be avoided entirely if you're trying to push your existing local repository to a new GitHub repo: Simply use the VCS > Import into Version Control > Share project on GitHub option and use the dialog to create a new GitHub repository.

How to rename rails app, folder and git remote repo?

I have a rails app called appname and a remote repo at bitbucket with the same name. I would like to rename it to another_name.
So far, I've tried changing the remote repo's name to another_name, tried git push and it fails. I didn't try renaming the rails app & its folder though, being afraid that something might break.
What's the right step to do this?
If you rename your remote repository, you also have to update the remote's URL in your local git repo:
git remote set-url origin https://new-url-here
You can rename the local folder freely without any side-effects.
Thanks to Agis' answer, this is how I did it:
Rename the repo in bitbucket website to another_name.
Run git remote set-url origin git#bitbucket.org:myname/another_name.git (I'm using SSH instead of HTTPS)
Rename my rails' app local folder to another_name using Windows explorer.
Open up text editor, use the find all feature to find all the files that contain the old name & replace the old name with the new one.

Resources