.bashrc is causing git push to fail

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to push code using git to my remote server, but I get the error:
fatal: protocol error: bad line length character:
8
I researched this bug and it turns out my .bashrc file that echos out a welcome screen is causing this error. What I would like to do is determine if this is a git push and to NOT display the welcome screen, or only display the screen when logging into SSH with no directory parameter:
ssh user@ssh-server.foo:/deployment/bare-git-repo
Here is the relevant lines in .bashrc:
if [ -e ./.doc ]
then
cat ./.doc
pm2 list
fi
Thanks in advance!
bash git bashrc
add a comment |Â
up vote
0
down vote
favorite
I'm trying to push code using git to my remote server, but I get the error:
fatal: protocol error: bad line length character:
8
I researched this bug and it turns out my .bashrc file that echos out a welcome screen is causing this error. What I would like to do is determine if this is a git push and to NOT display the welcome screen, or only display the screen when logging into SSH with no directory parameter:
ssh user@ssh-server.foo:/deployment/bare-git-repo
Here is the relevant lines in .bashrc:
if [ -e ./.doc ]
then
cat ./.doc
pm2 list
fi
Thanks in advance!
bash git bashrc
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to push code using git to my remote server, but I get the error:
fatal: protocol error: bad line length character:
8
I researched this bug and it turns out my .bashrc file that echos out a welcome screen is causing this error. What I would like to do is determine if this is a git push and to NOT display the welcome screen, or only display the screen when logging into SSH with no directory parameter:
ssh user@ssh-server.foo:/deployment/bare-git-repo
Here is the relevant lines in .bashrc:
if [ -e ./.doc ]
then
cat ./.doc
pm2 list
fi
Thanks in advance!
bash git bashrc
I'm trying to push code using git to my remote server, but I get the error:
fatal: protocol error: bad line length character:
8
I researched this bug and it turns out my .bashrc file that echos out a welcome screen is causing this error. What I would like to do is determine if this is a git push and to NOT display the welcome screen, or only display the screen when logging into SSH with no directory parameter:
ssh user@ssh-server.foo:/deployment/bare-git-repo
Here is the relevant lines in .bashrc:
if [ -e ./.doc ]
then
cat ./.doc
pm2 list
fi
Thanks in advance!
bash git bashrc
asked Jun 22 at 11:54
mwieczorek
1032
1032
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
I donâÂÂt think thereâÂÂs anything specific to git push hooks on the server, that you could use, but you could check whether youâÂÂre outputting to a terminal:
if [ -t 1 ] && [ -e ./.doc ]; then
cat ./.doc
pm2 list
fi
This will deal with a number of other cases where outputting the contents ./.doc doesnâÂÂt serve much purpose and could cause problems.
add a comment |Â
up vote
1
down vote
I suspect what you really want to do, is prevent running things which have no business being run in a non-interactive shell from running.
A common tactic for this, is to check whether stdin is not attached to a terminal via [[ ! -t 1 ]], or to check whether the bash process is not marked as interactive via [[ $- != *i* ]]. If one of these failure cases evaluates to true, then nothing else in your bashrc should get executed at all, and you should just return early.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
I donâÂÂt think thereâÂÂs anything specific to git push hooks on the server, that you could use, but you could check whether youâÂÂre outputting to a terminal:
if [ -t 1 ] && [ -e ./.doc ]; then
cat ./.doc
pm2 list
fi
This will deal with a number of other cases where outputting the contents ./.doc doesnâÂÂt serve much purpose and could cause problems.
add a comment |Â
up vote
2
down vote
accepted
I donâÂÂt think thereâÂÂs anything specific to git push hooks on the server, that you could use, but you could check whether youâÂÂre outputting to a terminal:
if [ -t 1 ] && [ -e ./.doc ]; then
cat ./.doc
pm2 list
fi
This will deal with a number of other cases where outputting the contents ./.doc doesnâÂÂt serve much purpose and could cause problems.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
I donâÂÂt think thereâÂÂs anything specific to git push hooks on the server, that you could use, but you could check whether youâÂÂre outputting to a terminal:
if [ -t 1 ] && [ -e ./.doc ]; then
cat ./.doc
pm2 list
fi
This will deal with a number of other cases where outputting the contents ./.doc doesnâÂÂt serve much purpose and could cause problems.
I donâÂÂt think thereâÂÂs anything specific to git push hooks on the server, that you could use, but you could check whether youâÂÂre outputting to a terminal:
if [ -t 1 ] && [ -e ./.doc ]; then
cat ./.doc
pm2 list
fi
This will deal with a number of other cases where outputting the contents ./.doc doesnâÂÂt serve much purpose and could cause problems.
answered Jun 22 at 12:39
Stephen Kitt
139k22299361
139k22299361
add a comment |Â
add a comment |Â
up vote
1
down vote
I suspect what you really want to do, is prevent running things which have no business being run in a non-interactive shell from running.
A common tactic for this, is to check whether stdin is not attached to a terminal via [[ ! -t 1 ]], or to check whether the bash process is not marked as interactive via [[ $- != *i* ]]. If one of these failure cases evaluates to true, then nothing else in your bashrc should get executed at all, and you should just return early.
add a comment |Â
up vote
1
down vote
I suspect what you really want to do, is prevent running things which have no business being run in a non-interactive shell from running.
A common tactic for this, is to check whether stdin is not attached to a terminal via [[ ! -t 1 ]], or to check whether the bash process is not marked as interactive via [[ $- != *i* ]]. If one of these failure cases evaluates to true, then nothing else in your bashrc should get executed at all, and you should just return early.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I suspect what you really want to do, is prevent running things which have no business being run in a non-interactive shell from running.
A common tactic for this, is to check whether stdin is not attached to a terminal via [[ ! -t 1 ]], or to check whether the bash process is not marked as interactive via [[ $- != *i* ]]. If one of these failure cases evaluates to true, then nothing else in your bashrc should get executed at all, and you should just return early.
I suspect what you really want to do, is prevent running things which have no business being run in a non-interactive shell from running.
A common tactic for this, is to check whether stdin is not attached to a terminal via [[ ! -t 1 ]], or to check whether the bash process is not marked as interactive via [[ $- != *i* ]]. If one of these failure cases evaluates to true, then nothing else in your bashrc should get executed at all, and you should just return early.
answered Jun 22 at 13:23
eschwartz
1016
1016
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451286%2fbashrc-is-causing-git-push-to-fail%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password