First I want to say, pls believe me this is not a problem about command less a file or a problem could solve by typing q(or:q whatever)...
My trouble is that the Powershell get stuack only with a flashing underline after a git command finished. Here the 'finish' define as a command should have been exited. An example picture is as fllow.
As you can see, the command git log -2 should be exited immediately. There's absolutely no need for me to enter q or :q. There is same trouble when I pressed a key q after run command git log or git diff.
However, after I run the powershell as Administratior user, the trouble disappears. The picture is as fllow.
I have tried many ways, but the problem always be there. The ways I have tried include downgrading the git version, rm the git repo dir and re-clone.
I guess it may be the problem about file permissions, but I have no idea to solve it, please help me(ó﹏ò。)
Related
I realize this question has been answered in other threads. However, my issue (I believe) is unique.
Backstory: I am a git bash noob. I only recently started using it, and as a result, have done quite a few dumb things. I create a test file, AWACSfile.txt, staged it with git add. I then did git commit, and here is where the problems started.
It brought up a new screen & prompted me for notes (or some other requirement when staging) that I did not add to the commit line. At that point, I didn't know what to do and attempted to exit the bash shell.
It gave me a warning saying processes were still open. I ignored it, assuming that they would terminate when I exited the shell. Wrong. Following that, I was unable to merge branches, switch branches, I could not delete the file, I could not unstage the file, I cannot do anything really without it giving me the attached error:
I attempted to delete the index.lock file as well, but same error was met. I'm at a point where I have no idea what to do - I even tried uninstalling & it wouldn't uninstall because the process is still open with no force kill.
It gave me a warning saying processes were still open. I ignored it, assuming that they would terminate when I exited the shell. Wrong.
Windows has mandatory file locking, meaning if a process has a file open you cannot delete it. Something is holding onto index.lock and shutting down the shell might not kill it.
Without seeing your previous Git history I can't say what that process might be. It could be any number of things which use index.lock hanging. An editor process used by git commit could be the culprit. You could find the process which is holding index.lock open and kill it.
Or you can try turning it off and on again: ie. restart your computer to ensure any hanging processes are stopped.
I start git bash and it flashes open for a second and then closes.
Please how can I fix it?
Background:
My computer is a dell laptop using Windows 8 version 6.3 (build 9600). After forking a big repo and cloning half of it onto my computer,
it was taking too long, so I closed git bash. Then I encountered the problem that it closes right away when I open it.
Title that appears in top of git bash window
/usr/bin/bash --login -i
What have I already tried, yet to no avail?
I rebooted the computer.
I uninstalled and reinstalled git bash.
I tried editing .bash-profile.
I tried running git bash from the git command and windows command prompt. Same problem occurred. But no error message appeared.
I tried deleting the big repo which I had partly cloned.
I expect git bash to stay open so I can use it.
What actually happens is that it closes immediately after opening it.
I would launch Git Bash from a command prompt. It may be writing a message to stderr that you won't see if you launch it from the Start menu.
Open a command prompt and, assuming Git is installed in the default location, enter the command
"C:\Program Files"\Git\git-bash.exe
I hope to add a Windows Scheduled Task to git push to github every night. I have a CMD file. When I run the CMD file on the windows command prompt, it works fine. But when I run it via windows scheduled task. It's stuck forever. The status is "running". And from the log I can see it successfully started the git bash shell. Any idea?
echo git push > i:\gitpush
echo 'pushing' >>log1
C:\WINDOWS\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login i:\gitpush" >>log1 2>>error
echo 'done pushing' >>log1
del i:\gitpush
Here is the log output:
'pushing'
Welcome to Git (version 1.7.4-preview20110204)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Then I did an experiment to rename gitpush script to a wrong file name. And it exited immediately with the error "No such file or directory", which is expected. It shows the gitpush script is passing in correctly to the bash but for some reason it's stuck.
The reason I have to go through git bash shell is because I don't know how to setup public key in windows command line shell without using git bash shell.
Thanks!
I don't know how to setup public key in windows command line shell
Public/private keys work also in a DOS shell, provided you define the %HOME% environment variable (referencing the parent directory of the .ssh)
The trick with Windows Scheduled Task is to make sure:
who is actually running the task (the "system account"? or the actual user?)
Displaying "env" can help debugging the issue.
where it is run: if git push depends on the current path to properly push the current repo, you need to be certain that your task runs where it is supposed to.
For daily backup of my mercurial repositories on Windows XP I used a simple batch file hg_backup.bat which just did some directory changes and mercurial calls with a pause command in the end like this:
#Z:
#cd \hg_backup\drawings
hg pull -v
#cd \hg_backup\src\scripts
hg pull -v
#cd \hg_backup\eagle4\lbr
hg pull -v
#pause
This worked fine with mercurial up to 1.7 (installed with TortoiseHg). However since mercurial 1.8 it starts the very first mercurial command and then exits abruptly without reaching the following commands or even the end of the script. The command window just disappears.
I had the same problem some time before, when I tried the same thing with git, but didn't investigate further, because I use git for one repository only. It seems to me, there's some return code of the hg command line call involved which causes the script to end instead of executing the other command but I couldn't verify this yet.
Has anyone an idea why this happens or maybe even how to fix it?
If your hg is a hg.bat or hg.cmd, use call hg and see if it starts working.
The command.com shell executes batch files replacing the old script (to save memory), and requires using call to start a batch script and continue execution later. This behavior remains in Windows cmd.exe for compatibility.
I had the exact same problem, but the solution provided by #grawity didn't work for me (and I have no idea why).
The solution in my case was to replace call with cmd /C, like so:
cmd /C hg sum
cmd /C hg stat
Folks, I'm using git tools such as git bisect run which need to call a command to build and test my project. My command to do is nant which is a windows program. Or a build.cmd script which calls nant.
It's easy to get the bash to call the nant build to run.
But the hard part is how to get the standard output written to a file?
I even installed the Windows PowerShell to try running a command from bash.
Again, it works but the standard output fill says "permission denied" when
I try to read it while the build is going on.
Update:
When running nant, the entire path is used. It is installed and runs fine. The problem is how to get the standard output when running from bash.
If running nant from the windows prompt with "> build.out" at the end of the line, you will get the standard out. But the same never works under bash. It just says build.out is locked, permissions denied.
Update:
Using tee as suggested below also doesn't solve the problem. In that case the file still report "access is denied" with any attempts to read it while the build runs. But also, the tee program never writes anything to standard output.
(If I am understanding your question correctly...)
You can probably use the 'tee' command to split the output to both a file and stdout. The line echo I am building something | tee build.out will both print the output on the console and save it to the file named "build.out".
The tee command is usually available in Cygwin, and also apparently in the Bash shell installed by msysgit (where I just tested it). Here's a good reference page for more details.
Okay, finally resolved this. It turns out the the nant build script was using git feature to erase all ignored files to cleanup. That was deleting the build.out file can causing these strange issues. Now, the process writes the build.out file to a parent directory so that it won't get deleted and now everything works smoothly as expected.