Unable to git push my repository after configuring Git LFS

After following all the steps in the Netlify large media guide I’m getting the following error message while trying to git push or git lfs push origin master:

batch response: creds: parse //git@gitlab.com:username/repository.git: invalid port “:username” after host

Versions:

git version 2.23.0
git-lfs/2.8.0 (GitHub; linux amd64; go 1.12.8)
netlify-cli/2.11.27 linux-x64 node-v11.15.0

My .git/config:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = git@gitlab.com:username/repository.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[lfs "https://random-uuid.netlify.com/.netlify/large-media"]
	access = basic

My global .gitattributes file:

*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text

My .lsconfig file:

[lfs]
	url = https://random-uuid.netlify.com/.netlify/large-media

How do I resolve this issue?

After changing the Git SSH link to the HTTPS version I managed to successfully git push, I’ve verified that the pointer files are in the Gitlab repo but the images are currently not showing up in the dashboard.

No assets found
Your site has no large media assets uploaded.

How can I troubleshoot this issue?

Hi @Hyperfocus, can you share the URL or site ID for your Netlify site so we can take a look? Thanks.

Site id is sent with PM

Hi @Hyperfocus, thanks. I see you have git-lfs enabled but you don’t have any assets. Can you do git-lfs push -all on your machine and let us know if the items show are sent over?

Hey, thanks for your help. I’m getting the following response:

Specify a remote and a remote branch name (git lfs push origin master)

See my .git/config file in the initial post… unsure how to manually push the images to the Netlify endpoint

Hi, @Hyperfocus. We identified an issue last week which was preventing any assets from being pushed to Large Media but this was also resolved last week. Are you still seeing this issue?

If so, is the Netlify CLI tool helper enabled in your local shell profile? This is normally a line similar to the following in .bash_profile (or similar file):

. /home/username/.netlify/helper/path.bash.inc

If this line already exists, please try logging our and back into the Netlify CLI tool like so:

$ netlify logout
$ netlify login

If this still doesn’t resolve the issue, would you please let us know here and we’ll open a support ticket for this.

In the final line of my .bashrc file the following is declared:

# The next line updates PATH for Netlify's Git Credential Helper.
if [ -f '/home/user/.netlify/helper/path.bash.inc' ]; then source '/home/user/.netlify/helper/path.bash.inc'; fi

I also manually entered this at the top of the file (it seems this is redundant):
source /home/user/.netlify/helper/path.bash.inc

I’ve verified that the file itself exists, it contains:

script_link="$( command readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"
apparent_sdk_dir="${script_link%/*}"
if [ "$apparent_sdk_dir" == "$script_link" ]; then
apparent_sdk_dir=.
fi
sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && command pwd -P )"
bin_path="$sdk_dir/bin"
if [[ ":${PATH}:" != *":${bin_path}:"* ]]; then
export PATH=$bin_path:$PATH
fi

I’ve tried logging in and out but upon running git-lfs push --all I’m still getting:

Specify a remote and a remote branch name (git lfs push origin master)

What other details do you require to further troubleshoot this issue?

This post has gone quiet for a while so you may have found a solution, but I ran into this exact same problem and wanted to shared how I solved it/what I learned.

The short version is that apparently the latest version of git-lfs (2.8.0) is broken in a specific way that causes this to happen. Details are on this github issue: https://github.com/git-lfs/git-lfs/issues/3831

According to that issue, they should be releasing 2.9.0 in “Early October” (so, soon, hopefully) which will correct the issue, but in the meantime you can use https instead of ssh to get around it, which is what I ended up doing (after I spent a good 15 minutes trying to log in with a password that didn’t work because I have 2FA on and needed to generate a personal github token instead).

1 Like

@alwaysblank, thank you for sharing that information and welcome to our community site. :slightly_smiling_face:

Yes, we did find a solution and most of the ticket was troubleshooting something else.

But this information does appear to be the root cause and solution for the issue above. I’ve shared these details with our developers as well to make sure all parties are “in the loop”.

Thanks again for this as this almost certainly the root cause (and workaround in the meantime).