not showing correct updates while commit with github for windows - github-for-windows

I have installed the github for windows http://windows.github.com/.
Also already clone a repository into my local drive. I created a branch, and make some update on one file, e.g: index.html. When I commit with github for windows. Github seems to treat it as whole file update (whole line becomes red), instead of showing the modification which I've already made. But this will not happen while I commit with command line.
Does anyone seems ever to have same problem with me? Please tell me what should I do to make the git didn't treat my files as a whole update?
Thanks.

When you write files in Windows, they have a CRLF line endings. Lines with \n and \r\n line endings are different for Git. Please check your editor's and Github for Windows preferences. They can convert CRLF<->LF automatically.

Based on Rustam Safin about the CRLF line endings, recently I found this solution was helpful.
https://help.github.com/articles/dealing-with-line-endings
I have tried it, and it's resolve my problem.

Related

"Cannot publish, unborn head" error message

I know there are other questions on here about this issue, but this case is different because it's not caused by an empty repo folder or anything, and I've been pushing changes to this same repo using GitHub desktop for some time. After I type my changes into the summary window, I hit Commit to Master (branch is already set to master, like always). But I get the unborn head issue, along with the alert that my repo's name is too long. Again, this has never happened, and the name has never been an issue previously. Here's a screenshot for reference:
Does anyone know what might be causing this?
The error is due to a file in "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/VisualStudio/15.0_8067392e/VTC/" having a name that is too long. The filename looks like it is generated by a tool, not written by you. In fact it looks like the whole "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/" directory is probably not code that you are working on yourself.
With version control, it is best to ignore any files and folders that are generated somehow, such as this "Microsoft" folder. With git, you can do that in your .gitignore file with the following line, assuming that "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/" is your project root:
AppData/Local/Microsoft
In fact, if "AppData" contains only generated files, then you can even ignore just that.
I was using Sublime Text ver 3.2.1 working on a fresh copy of laravel in wamp. I had this issue of 'cannot publish unborn head' when using GitHub Desktop to publish for the first time. Solved by typing something in the title under Summary. As an aside, I included .editorconfig in my gitignore file.

mercurialeclipse not showing complete history

I've shuffled things around, moving my files to another directory. Now when I click Show History, I only see the branch that I moved the files in.
I'm using eclipse neon, latest version of the mercuraleclipse plugin.
Here are the changes I made. There are old projects that have the source (.java) files in the top-level. So I created a src directory and used hg move to move the files under src. Once I did this, when I click on a file to see the history, It only shows the one change in the new mercurial branch I made the change in.
First thing that comes to mind is which version of MercurialEclipse are you using?
I'm asking because I have solved this very issue a few months ago in the official MercurialEclipse repository. The fix required also making a small change to the library that hgE uses, namely javahg.
Also, maybe that it'll help to have this in your .hgrc file (this file is in C:\Users\theUserName on my Windows 8.1 system. Please, refer to the Mercurial documentation for other systems)
[defaults]
log = -f
addremove = --similarity 100
commit = -A
I'm not sure that log = -f is pertinent to this issue but I have these lines in my file. I can't believe I didn't comment each of these so as to know why each is necessary or useful. Since the fix on August 31, commit = -A is no longer necessary , but I keep it in the file just in case I use hg on the command line.
As a rule of thumb, you may also check directly on the command line whether any problem you encounter with hgE also shows up with hg. That will provide the team as a whole with some useful insight.
Make sure that you use a build of hgE from after that date. If you still have this problem later on, please open an issue on the BitBucket tracker with as many details as possible. I'll fix the problem and we'll update this question with the solution/answer.

No change after committing in git

When I check out a project from git, many files need to commit, but nothing changes, can anybody tell me why ?
I just checked out from git, doing nothing, I am sure it's not the text encoding thing
Differences may be related to file execution permissions. If so, git diff will give you the old chmod/current chmod. To restore it to the correct permissions, you can do git checkout . or git reset --hard.
Other solution if you simply don't care about files permission, you can tell git to ignore it by editing .git/config.php or by typing from the root directory git config core.fileMode false
I have got the answer, the reason is the line delimiter of the eclipse, its default is Unix, when I changed to Windows, everything is fine, thanks.

Untrack files without removing from remote repository

In our company, we just started using Mercurial and we are facing the following problem:
We have some files in the remote repository that are changed by each developer to add some local configuration but these files must never be changed in the remote repository.
Is there a way to tell Mercurial to stop tracking those files locally without making any change to the file on the remote repository?
We tried with hg forget <file> but as I understand, this will remove the file from the remote repository.
We also tried adding those files to .hgignore file, but somehow the files are not really being ignored, I guess Mercurial does this because the files are already being tracked.
So far, we are just ignoring the files when we perform a commit and we use shelve to maintain and restore our local changes after an Update, but it's starting to be a really tedious task.
Thanks in advance for any help.
EDIT: Although it didn't completely fix what we wanted to, accepted answer is the best approach. Our problem is probably a result of a bad design.
If the file you want unchanged is, for example, config.cfg, check in a config_template.cfg, forget config.cfg if it is already tracked, and add config.cfg to the ignore list. Then, a build rule can create config.cfg from the template if it does not already exist.
A user will then have a starting config.cfg that they can customize without checking it in.
You could use the configuration [defaults] section to add some "--exclude" options to usual commands (see my answer to Mercurial hg ignore does not work properly ) for more details.
But.. be careful that it is dangerous to silently ignore modifications to files and also that this [defaults] section has been marked as deprecated (it is still present in 2.9.2).
IMHO it's a wrong approach to have a file in the repository which every person needs changed anyway - it's an indication that you do not want to have it tracked at all.
Change the file to config.sample, and have your programme create a default config upon first start (thus when there's no existing config file) and have every developer use the config file as s/he needs.
And I see Mark Tolnen's answer only now :)

Github windows: Commit failed: Failed to create a new commit

I have: http://windows.github.com/
My current project has around 20k files, around 150MB (and not speaking about how slow it is and I cannot do a thing now) it doesn't even let me commit! I get this error: Commit failed: Failed to create a new commit.
That seems that nobody is having.
I've already deleted the folder and cloned again, no escape. What to do?
If I choose to open shell, all this *** crashes!
Edit:
Since the problem I've switched to Git Extensions and I didn't look back!
thanks for your answers
This happened to me. Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been added, enter "git status" into the command line. The green files have been added, the red ones have not been added.
Once you've added them all, type "git commit." Then go back to Github for Windows and sync it up.
I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.
I had this problem too after an unexpected crash. I couldn't fix using the 'Open Shell' option as suggested. I had to open the Windows CLI (Start -> run -> cmd) and delete the index.lock file in my GitHub folder:
cd \Users\myUser\my\local\github\repo
cd .git
del index.lock
Then when I went back to the GitHub app, it committed successfully.
Note that for some people, according to comments, the file to delete doesn't have the .lock extension, so the delete command could also be del index.
Im using Githug for Windows (7) and faced the same problem. While using PowerShell I realized that I didn't fill Full Name and email address in tools > options. Look like a beginner mistake (and I am!).
hope it helps!
just try to commit a few from your updates. 5 for example. and then make another commit with all other updates.
I am using windows client and getting the same error. Then suddenly I realized that my local db in app_data was opened on the SQL management. It just simply can't commit the some files to github if they are opened or using at the other programs.
Just disconnected management studio closed it and just simply committed.
This may be your case also. Check your files out!
So guys this is the full steps I had to take in order to fix the problem...
1) Using Process Explorer (you can download it form here http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) I searched for any process referencing ".git\index" and then I killed it.
2)Then using Git Shell (Windows Power Shell) I went into the repository which was giving me such difficulty and then furthermore went into its .git folder. (cd .\your_respository_name\.git). I then removed the index.lock file in that directory (rm -r index.lock).
3)Then from within that same directory I ran git reset HEAD.
4)Then I manually committed each file using the "git add [file_name]" comand. (You can check that they were added successfully if when you run git status, the files are green.
5)Next run git commit if your files are added correctly.
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
This issue seems to be a bug in the github client - I get it "all the time" on the machine on which i only installed the github client.
I Never saw it on the git + github PC (I have not used it for a few days now).
Doing the "git add ." and then "git commit" worked for me also on the shell - but that is the thing the GUI should be doing not me - otherwise I can just stick to the git shell client.
Had the same problem, couldn't commit or sync using the windows GUI, but I could commit the changes through the shell. Once I'd added the changes through the shell the windows GUI started to sync normally. Hopefully it's a one off.
I had an interesting issue - even though I had an excel file open called "Combined - ForImportv4.xlsm", Git UI had no problem checking that in but it gave the error in the OP's subject for the backup file "~$Combined - ForImportv4.xlsm" so I discarded that change and all went through.
PS: As for why i'm checking an Excel file into Git ... just don't got there :)...
I had this issue with the git windows desktop commit tool. I was getting this often and I figured out that Visual Studios was locking the files. To get around this issue I simply closed visual studio and the commit / sync worked fine.
I googled failed to create repository and ended up here.
My problem was that the description for my new repo was too long. There is a charlimit for the description, but GitHub tried to push it anyway and failed.
I just had the same problem, tried some of the suggestions on this post but none worked so what i did was, on the GiTHub client i went to tools -> settings and then click on the section where it says add/create default ignored files. Then hit Update and try to commit again through the client.
It happend to me when my project was opened in an IDE (Netbeans in my case), make sure non of the files you're about to commit isn't open in some program.
I checked the log file at C:\Users{user}\AppData\Local\GitHub\TheLog.txt and found this error:
LibGit2Sharp.LibGit2SharpException:
Could not open 'SomePath\SomeProject.opensdf':
The process cannot access the file because it is being used by another process.
I closed Visual Studio and the commit was then created successfully.
n.b. I removed actual file path in the above error.
If you are new user make sure that you have confirmed your e-mail. Had same problem and confirmation fixed it!
You can manually navigate to index.lock which is found inside the hidden .git folder of your repository location. Once you delete index.lock you will be able to commit as per usual.
The easiest way to navigate to the folder will be to click on the folder breadcrumbs inside windows explorer and add \.git and press enter.
Just delete 'index.lock' in the '/.git/' directory. Solved the problem for me instantly.
I had this happen to me and this is the easiest way to fix it:
Make a copy of your local folder that has the repo and remove the .git folder form it.
Delete the original repo folder with files.
Re-clone the repo from GitHub with the Windows client.
Delete all of the files that get cloned except for the .git folder.
Copy all files from the copied folder into the new clone folder.
Add in your commit notes and the commit should work this time.
I had the same problem and I fixed it by renaming one of the file because its name was too long. This fixed the problem.
Here is error message from git shell:
fatal: unable to stat 'plugins/com.napolitano.cordova.plugin.intent/example/app/platforms/android/CordovaLib/build/intermediates/classes/debug/org/apache/cordova/NativeToJsMessageQueue$OnlineEventsBridgeMode$OnlineEventsBridgeModeDelegate.class': Filename too long
I REBOOTED my Windows 7 machine and tried again - IT WORKED!
I had the "Commit failed: Failed to create a new commit" and tried to delete the index or index.lock file via windows command prompt and that didn't work. I deleted it via windows explorer, that didn't work.
I tried to check credentials like another reply in this list said, but couldn't figure it out and the credentials seemed 'ok.' So - I rebooted. Viola.
I'm not sure this will help anyone, I'm not all that great w/ this stuff, but trying.
I deleted ".git" in children directory and the problem was resolved.
It happened to me once ,I had a empty repository inside of the repository that I cloned.
It was a silly mistake though but could happen .