I have a simple bash script written on a WSL Ubuntu system; it runs perfectly there. I then git push it up to github, and go to a different systems WSL Ubuntu and git clone the project, cd into that folder and run the script, but it is broken with the below errors.
I tried dos2unix on it, but this does not work, same errors and same broken state. Do you have some suggestions about what might be causing this (something is changed by storing it in github I guess), and how to fix (as before, none of the below errors are seen on the originating WSL Ubuntu system, where the script runs perfectly)?
: command not found
: command not found
: command not found
: invalid shell option name
: command not found
: command not found
-bash: .custom: line 147: syntax error near unexpected token `$'{\r''
'bash: .custom: line 147: `fnheader() {
I had the same problem with Windows line endings, so my solution was:
# Remove cloned repo
git config --global core.autocrlf input
# Clone again the repo
Let me know if it works for you too.
Regards.
Related
While locally deploying an app in PyCharm on windows10, I have encountered several mistakes.
Make test command returned following mistake:
service "core" is not running container #1
make: *** [Makefile:60: test] Error 1
And indeed container status with the command make ps returned exited(127). When I have checked docker logs for the container in question, I've seen:
/usr/bin/env: ‘bash\r’: No such file or directory
In this thread, this mistake is connected to how windows processes line endings of files from different OS. The usual solution is:
git config --global core.autocrlf false
But after running the code and updating current git repo and restarting the containers, i still get the same mistake. What might be the issue here?
What did helped me
I assume that the problem was in the windows line endings in the Unix-based containers.
To solve it I found two very helpful instructions:
Configure your line separators in the PyCharm https://www.jetbrains.com/help/pycharm/configuring-line-endings-and-line-separators.html
To clarify that changes were really enabled, I have checked the files in the notepad++
https://notepad-plus-plus.org/downloads/v8.1.9.3/
Also it was helpful to check the original code because part of the problem was the incorrect spelling of some commands.
When I use Windows in Docker and run a bash script, I have a similar problem, which I solve by using LF instead of CRLDF as the line separator.
in vscode, we can change it here
I'm trying to install the heroku cli locally on win 7 -64 bit. I downloaded and ran the installer at https://devcenter.heroku.com/articles/heroku-cli#windows. I can see that the path E:/Heroku1/bin/ has been added to PATH. Using git-bash I try:
$ heroku -v
/e/Heroku1/bin/../client/bin/heroku.cmd: line 1: #echo: command not found
/e/Heroku1/bin/../client/bin/heroku.cmd: line 3: fg: no job control
How can I get this working?
I think the problem is that I may have been using an outdated git-bash. At this point in time they recommend using Git 2.8. I added the following to my path and it started working:
C:\Git28\bin;C:\Heroku\bin
I installed Sublimerge on SublimeText2, it was working fine until it started giving the following error
/bin/sh: git: command not found Exit code: 127
Git path on the computer has not been changed and git works as is. Not sure why then Sublimerge is unable to find the path.
Thanks.
The git location inside the sublimerge settings file was incorrect and after fixing, it started working correctly.
Just installed git and when I run the git bash and enter git -version I get this error: sh.exe": /bin/git: bad file number.
During the installation I had one error but the installation proceeded :"unable to configure the line ending conversion core.autocrif true." Git GUI isn't launching and I get the error : "Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item." Trying to run as admin doesn't change it.
I run into this problem occasionally (including about 5 minutes ago) and I "solve" it by re-installing the Git client.
I was using SourceTree + Git on Windows without any problem. I was able to use git commands from command (terminal/BASH). I prefer to use terminal for git push/pull etc. Unfortunately, after reinstallation of my machine (server/git are the same), I'm getting this painful error.
On a new machine, I installed Git 1.9.5 (Git-1.9.5-preview20141217.exe) and configured to use BASH only and plink with proper SSH key file.
I can do git log on my repository, but git pull or git push gives this error:
me#NEW-MACHINE /c/Workspace/project (master)
$ git pull
fatal: protocol error: bad line length character:
#-
ERROR: Problem parsing the command line arguments.
Of course, I searched many articles related to "fatal: protocol error: bad line length character". But, couldn't find any clue.
Interestingly, on SourceTree, I can do git pull or push successfully. I'm only getting this error in BASH terminal. Note that SourceTree doesn't use embedded git.
Here are my investigations so far:
I installed an older version of git (1.8.x), still getting error.
Moved .bashrc, but no good.
Obviously, not a problem of SourceTree as SourceTree doesn't use embedded Git.
The server is in Github (enterprise, private).
I have no problem using any git commands on my Linux with the same git repository/server.
My clue is <newline>#-<newline> from the error message. It is more like a problem of Windows/BASH-specific problem. I can't figure it out what causes "#-".
Edit: I tried suggestions in this thread, but didn't solve my problem. The git server is github.mycompany.com, which doesn't allow any ssh connection.
You can circumvent the bash-ssh issue entirely by:
launching a DOS shell with git-cmd.bat (packaged within your Git for Windows msysgit distribution)
using git clone to make a new clone using the proper https url of your remote repo.
That is:
git clone https://<yourAccount>#github.mycompany.com/<yourAccount>/<yourRepo>
Since you will be using in this case the https protocol, there won't be any shell session during a git pull (as opposed to the ssh protocol: see The Smart Protocols), and you shouldn't see any extra message like fatal: protocol error: bad line length character.
I had same issue for git in windows.
Load your public/private key by Pageant App (Putty Authentication Agent).
add private/public key.