Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid character "\\" in host name #82

Closed
jmichaelknox opened this issue Mar 13, 2019 · 8 comments
Closed

invalid character "\\" in host name #82

jmichaelknox opened this issue Mar 13, 2019 · 8 comments

Comments

@jmichaelknox
Copy link

I'm having some trouble getting blobs to push into lfs-test-server. I've tried to construct a standalone setup on two different machines: a home laptop using Windows 8 and a (airgapped) work laptop using Windows 7. Results were the same for both.
As instructed in the lfs-test-server installation instructions, I in lfs-test-server setup I changed the environmental variables LFS_AdminUser (test) and LFS_AdminPass (testpass) in order to open \mgmt and add a user (testuser) and password (testpass). The only way I could figure out how to do this was using advanced properties in windows control panel and adding through the advanced system properties in the windows control panel. I can open mgmt template when I type http://localhost:8080/mgmt
All other environmental variables were left at default.


Here is my setup

  1. Local Repository is on following directory c:\users\dad\desktop\GITOUT\GITREPO

a) .git\ config file content is as follows:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true

b) .lfsconfig file (staged and committed) as follows:
[lfs]
url = "http://localhost:8080"

Note: I also tried url =http://localhost:8080/ and results were the same (explained at end of message).

c) .gitattributes file (staged and committed) as follows:
*.pdf filter=lfs diff=lfs merge=lfs -text
d) LFS Environment on GITREPO is:
Endpoint=http://localhost:8080 (auth=none)
LocalWorkingDir=C:\Users\Dad\Desktop\GITOUT\GITREPO
LocalGitDir=C:\Users\Dad\Desktop\GITOUT\GITREPO.git
LocalGitStorageDir=C:\Users\Dad\Desktop\GITOUT\GITREPO.git\lfs\objects
LocalReferenceDirs=
TempDir=C:\Users\Dad\Desktop\GITOUT\GITREPO.git\lfs\tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDown loadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=C:\Users\Dad\Desktop\GITOUT\GITREPO.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

  1. I cloned GITREPO to following directory c:\users\dad\desktop\GITOUT\GITCLONE

a) .git\ config file content is as follows:
[core]
bare = false
repositoryformatversion = 0
filemode = false
symlinks = false
ignorecase = true
logallrefupdates = true
[remote "origin"]
url = C:\Users\Dad\Desktop\GITOUT\GITREPO
fetch = +refs/heads/:refs/remotes/origin/
[branch "master"]
remote = origin
merge = refs/heads/master
[lfs "http://localhost:8080"]
locksverify = false
access = basic
b) .lfsconfig (unchanged) as follows:
[lfs]
url = "http://localhost:8080"
c) .gitattributes file (unchanged) as follows:
*.pdf filter=lfs diff=lfs merge=lfs -text
e) LFS Environment on GITCLONE is:
Endpoint=http://localhost:8080 (auth=none)
LocalWorkingDir=C:\Users\Dad\Desktop\GITOUT\GITCLONE
LocalGitDir=C:\Users\Dad\Desktop\GITOUT\GITCLONE.git
LocalGitStorageDir=C:\Users\Dad\Desktop\GITOUT\GITCLONE.git\lfs\objects
LocalReferenceDirs=
TempDir=C:\Users\Dad\Desktop\GITOUT\GITCLONE.git\lfs\tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDown loadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=C:\Users\Dad\Desktop\GITOUT\GITCLONE.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"


I am able to push files that I don’t track from GITCLONE to GITREPO no problem. However, when I attempt to push the .pdf file from the clone to the repository I’m expecting the repository to have the SHA-1 pointer, and localhost:8080 to show the .pdf object in the \objects screen.

However, I am not asked for my credentials and I instead get the following message:

Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
batch response: creds: parse //c:\users\administrator\desktop\GITOUT\GITREPO: invalid character “\” in host name
error: failed to push some refs to ‘c:\users\administrator\desktop\GITOUT\GITREPO’.

GITCLONE doesn’t push to GITREPO. I don’t even get the SHA-1 pointer in the GITREPO. I'm pretty sure that my lfs-test-server setup is incorrect. Is my problem that I set environmental variables for LFS_AdminUser and LFS_AdminPass within the advanced settings of windows? If so how do I set these without using windows? Should I change to https:?

I’m totally stumped.

@bk2204
Copy link
Member

bk2204 commented Mar 13, 2019

Hey, thanks for writing in, and sorry to hear you're having trouble.

In general, Git LFS doesn't deal well with local backslash paths when pushing. You're seeing this issue because we try to parse the URL given to acquire credentials, and the unescaped backslashes make it look like you have a corrupt URL.

You'll probably have more success if you use a file:// URL, perhaps formatted like so: file://c%3a/users/administrator/desktop/GITOUT/GITREPO/. A file URL would be a form that both Git and Git LFS could understand and would allow acquiring the credentials needed to push. You may have to fiddle around with various forms to get one that works correctly, but a file URL is definitely the way to go.

@jmichaelknox
Copy link
Author

A bit more info.

As recommended in issue no. 81 I also set GIT_TRACE GIT_TRANSER_TRACE and GIT_CURL_VERBOSE then pushed with git push origin master.

Everything looks okay until:

17:43:56.738978 trace git-lfs: tq: sending batch of size 1
17:43:56.738978 trace git-lfs: api: batch 1 files
17:43:56.738978 trace git-lfs: api error: creds: parse //c:\users\administrator\desktop\GITOUT\GITREPO: invalid character “\” in host name
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
batch response: creds: parse //c:\users\administrator\desktop\GITOUT\GITREPO: invalid character “\” in host name
error: failed to push some refs to ‘c:\users\administrator\desktop\GITOUT\GITREPO’.

@jmichaelknox
Copy link
Author

@bk2204 Thanks for quick turnaround. I'll give our suggestion a shot.

@jmichaelknox
Copy link
Author

@bk2204 OK I git clone ///c/users/administrator/desktop/GITOUT/GITREPO into GITCLONE and this created the link that you are talking about. I no longer get the message saying there is in an invalid character when pushing. However, when I try to git push origin master the system gets stuck and only says:
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done

It does not prompt for credentials.

When I look at the server it return status 401, which makes sense because I think what this is telling me is that the test server never receives authenticated username and password.

With GIT_TRACE GIT_TRANSFER and GIT_CURL_VERBOSE set. I get a continuous run of status 401. I can see that git lfs is trying to upload to the server, but fails.

So closer now, but I'm not getting instruction to type username or password.

@bk2204
Copy link
Member

bk2204 commented Mar 13, 2019

Can you post the output of the operation with those three environment variables set?

@jmichaelknox
Copy link
Author

@bk2204, I've gotten it to work on the Windows 8 computer at home. For the Windows 7 computer at work I had to include the computer admin name and password. It did push though. I never did get a pop-up for username and password. I'll be posting the output produced when just testuser and testpass were listed under the /mgmt./users .css soon as I get it cleared by IT. Thanks for your help.

@jmichaelknox
Copy link
Author

Here is the output for the Windows 7 computer at work when I git push origin master. The first time the test server returns a status 401 I shut it down. If I don't do that git tries to push the blob to localhost:8080 repeatedly.


C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo>set GIT_TRACE=1

C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo>set GIT_TRANSFER=1

C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo>set GIT_CURL_VERBOSE=1

C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo>git push origin master
13:21:46.253005 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
13:21:46.253005 git.c:419 trace: built-in: git push origin master
13:21:46.268605 run-command.c:643 trace: run_command: unset GIT_PREFIX; 'git-receive-pack '''/c/users/administrator/desktop/gitout/gitrepo''''
13:21:46.393405 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:46.393405 git.c:419 trace: built-in: git receive-pack C:/users/administrator/desktop/gitout/gitrepo
13:21:46.393405 run-command.c:643 trace: run_command: .git/hooks/pre-push origin file:///c/users/administrator/desktop/gitout/gitrepo
13:21:46.565005 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:46.565005 git.c:676 trace: exec: git-lfs pre-push origin file:///c/users/administrator/desktop/gitout/gitrepo
13:21:46.565005 run-command.c:643 trace: run_command: git-lfs pre-push origin file:///c/users/administrator/desktop/gitout/gitrepo
13:21:46.736605 trace git-lfs: exec: git 'version'
13:21:46.866609 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-na
me' 'HEAD'
13:21:47.062413 trace git-lfs: exec: git 'config' '-l'
13:21:47.124615 trace git-lfs: exec: git 'config' '-l' '-f' 'C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo.lfsconfig'
13:21:47.186817 trace git-lfs: pre-push: refs/heads/master e9ab0b4e5c67763f27292debe050c0294367d006 refs/heads/master 267c4c9abbf9d84f78cf3e4d0ad0ffc6f7c623f7
13:21:47.431619 trace git-lfs: tq: running as batched queue, batch size of 100
13:21:47.431619 trace git-lfs: run_command: git rev-list --stdin --objects --not --remotes=origin --
13:21:47.552622 trace git-lfs: tq: sending batch of size 1
13:21:47.553622 trace git-lfs: api: batch 1 files
13:21:47.555622 trace git-lfs: creds: git credential fill ("http", "localhost:8080", "")
13:21:47.604823 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:47.605823 git.c:419 trace: built-in: git credential fill
13:21:47.605823 run-command.c:643 trace: run_command: 'git credential-manager get'
13:21:47.746223 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:47.746223 git.c:676 trace: exec: git-credential-manager get
13:21:47.746223 run-command.c:643 trace: run_command: git-credential-manager get
13:21:48.136224 trace git-lfs: Filled credentials for http://localhost:8080/
13:21:48.136224 trace git-lfs: HTTP: POST http://localhost:8080/objects/batch

POST /objects/batch HTTP/1.1
Host: localhost:8080
Accept: application/vnd.git-lfs+json; charset=utf-8
Authorization: Basic * * * * *
Content-Length: 159
Content-Type: application/vnd.git-lfs+json; charset=utf-8
User-Agent: git-lfs/2.7.1 (GitHub; windows amd64; go 1.11.5; git 6b7fb6e3)

{"operation":"upload","objects":[{"oid":"ec4bfdfea443c79957855dac8979004369b776bce38297333dc4fa30b1b0758d","size":1088990}],"ref":{"name":"refs/heads/master"}}13:21:48.178826 trace git-lfs:
HTTP: 401

< HTTP/1.1 401 Unauthorized
< Content-Length: 26
< Content-Type: text/plain; charset=utf-8
< Date: Thu, 14 Mar 2019 20:21:48 GMT
< Www-Authenticate: Basic realm=git-lfs-server
<
13:21:48.242627 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:48.242627 git.c:419 trace: built-in: git credential reject
13:21:48.242627 run-command.c:643 trace: run_command: 'git credential-manager erase'
13:21:48.398627 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:48.398627 git.c:676 trace: exec: git-credential-manager erase
13:21:48.398627 run-command.c:643 trace: run_command: git-credential-manager erase
13:21:48.758428 trace git-lfs: api: http response indicates "basic" authentication. Resubmitting...
13:21:48.758428 trace git-lfs: creds: git credential fill ("http", "localhost:8080", "")
13:21:48.808629 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:48.808629 git.c:419 trace: built-in: git credential fill
13:21:48.808629 run-command.c:643 trace: run_command: 'git credential-manager get'
13:21:48.949029 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:21:48.949029 git.c:676 trace: exec: git-credential-manager get
13:21:48.949029 run-command.c:643 trace: run_command: git-credential-manager get
13:21:49.323430 trace git-lfs: Filled credentials for http://localhost:8080/
13:21:49.323430 trace git-lfs: HTTP: POST http://localhost:8080/objects/batch

POST /objects/batch HTTP/1.1
Host: localhost:8080
Accept: application/vnd.git-lfs+json; charset=utf-8
Authorization: Basic * * * * *
Content-Length: 159
Content-Type: application/vnd.git-lfs+json; charset=utf-8
User-Agent: git-lfs/2.7.1 (GitHub; windows amd64; go 1.11.5; git 6b7fb6e3)

13:21:58.515247 trace git-lfs: api error: Post http://localhost:8080/objects/batch: dial tcp 127.0.0.1:8080: connectex: No connection could be made because the target machine actively refuse
d it.
batch response: Post http://localhost:8080/objects/batch: dial tcp 127.0.0.1:8080: connectex: No connection could be made because the target machine actively refused it.
error: failed to push some refs to 'file:///c/users/administrator/desktop/gitout/gitrepo'

C:\Users\Administrator\Desktop\GITOUT\GITCLONE\gitrepo>

@bk2204
Copy link
Member

bk2204 commented Mar 19, 2019

It looks like the credential manager you're using is providing a username and password each time even though it's been told that the ones it provided aren't valid. Since it looks like you're using the Microsoft Git Credential Manager for Windows, this might be microsoft/Git-Credential-Manager-for-Windows#703.

You could try reaching out in that issue to see if they can help, or if you can access the credential manager storage, you could try to delete the entry directly. I'm not sure how to do that, since I'm not using Windows or that credential manager. Alternately, you could try using a different credential manager, such as wincred.

@bk2204 bk2204 closed this as completed Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants