克隆gitlab项目,它始终使用git lfs而不提供密码 [英] Clone gitlab project that uses git lfs without giving password all the time
问题描述
我决定尝试在gitlab上使用git lfs。我注意到它不适用于ssh,所以我决定使用https。推送工作得很好,但是当我试图克隆我的项目时,它向我询问了每个文件的用户名和密码。
这种烦人。是否有任何解决方法?
编辑2018
这个问题持续存在,真正的解决方案在哪里?有一个简单而直接的方法吗?
链接 https://git-scm.com/docs/gitcredentials 和 我的 当我做 尝试执行凭据时也存在问题(请参阅 issue#2223 )等等) 尝试报告:
描述的情况git lfs env
,
git-lfs / 2.4.0(GitHub; linux amd64; go 1.8.3 )
git版本2.7.4
LocalWorkingDir =
LocalGitDir =
LocalGitStorageDir =
LocalMediaDir = lfs / objects
LocalReferenceDir =
TempDir = lfs / tmp
ConcurrentTransfers = 3
TusTransfers = false
BasicTransfersOnly = false
SkipDownloadErrors = false
FetchRecentAlways = false
FetchRecentRefsDays = 7
FetchRecentCommitsDays = 0
FetchRecentRefsIncludeRemotes = true
PruneOffsetDays = 3
PruneVerifyRemoteAlways = false
PruneRemoteName = origin
LfsStorageDir = lfs
AccessDownload = none
AccessUpload = none
DownloadTransfers = basic
UploadTransfers = basic
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
git clone https://github.com/myPrivate/project1
问题克隆过程未完成(错误),并始终提供用户名和密码 ...
git config credential.helper
不输出任何信息,为空信息。 .git
URL?在它之后的命令 git add .lfsconfig code> say 致命的:不是git仓库(或任何父目录):.git在这两种情况下(带或不带.git的URL)
git config credential.https://github.com/myPrivate/MyProj1 myusername
say 致命:不在git目录,但当然,我需要先克隆(!)..
如 git-lfs issue 993 :
$ b
因为LFS服务器和git服务器可以是单独的端点,但用户有权使用git服务器而不是LFS服务器。
在这种情况下,如果有是安装的凭证管理器,凭证不会被重置,并且LFS将在每个后续请求中使用它们而不会使它们失效。
你应该检查你的 git config credential.helper
输出。
在Windows上,它应该是(最近的2017-2018 Git版本)manager。
打开Windows Credential Manager并清除或修复任何GitHub证书条目。
$ b 注意: issue 2349 指出Git-LFS在申请凭证方面存在问题(缺少助手),因为缺少pty / tty ,但那已经可能已经修复。
转换为假人
答案和评论)
-
检查
git --versi
,如果少于 2.16 ,请按照使用PPA < a> -
检查您的
git config凭证.helper
输出,如果它是空的, >执行以下行:git config --global credential.helper / usr / share / doc / git / contrib / credential / libsecret / git-credential-libsecret
...他们再次检查你的git config credential.helper
输出:需要这个/ usr /...
-
克隆...
3.1。 (如评论)首先:
git ls-remote https://github.com/myPrivate/MyProj1
...这应该会提示输入您的GitHub用户名和密码帐户。重复该命令以检查第二次,它不会提示你什么。
3.2。做你平常的
git clone
(注意用sudo rm -r oldBrokenBadClone
)去掉破损的旧版本...给用户名 git config credential.helper
outputs nothing, empty message.git config -f .lfsconfig lfs.url https://github.com/myPrivate/MyProj1
accepts anything... So, is the browser URL or.git
URL?
After it the commandgit add .lfsconfig
say "fatal: Not a git repository (or any of the parent directories): .git" in both cases (URL with or without .git)git config credential.https://github.com/myPrivate/MyProj1 myusername
say "fatal: not in a git directory", but of course, I need to clone first (!).....
check
git --version
, if less tham 2.16, install better as instructions here using PPAcheck your
git config credential.helper
output, if it is empty,
execute this line:git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
... Them check again yourgit config credential.helper
output: need to be this/usr/...
path.Cloning...
3.1. (as commented) Do first:
git ls-remote https://github.com/myPrivate/MyProj1
... That should prompt for your GitHub username and password account. Repeat that command to check that the second times, it does not prompt you for anything.3.2. Do your usual
git clone
(with care remove the broken old withsudo rm -r oldBrokenBadClone
)... Giving username-and-password once.
有关在许多UBUNTU LTS服务器上进行测试的最终注意事项...有时,当您克隆在这个过程之前,你不能修复这个问题( git pull
erros像git-credential-libsecret:not found)。解决方法是删除所有旧的克隆回购(谨慎使用 rm -rf
)。看起来你可以随时做 git config --global credential.helper
,所以,就这样做。再次克隆—可能会给用户名和密码两次,但在它之后会很好。
I decided to try git lfs on gitlab. I noticed that it doesn't work with ssh so I decided to use https for it. Push works just fine but when I tried to clone my project it asked me for a username and a password for every file.
That's kind of annoying. Is there any workaround to it?
EDIT 2018
This problem persist, where the real solution? There are a simple and direct recipe for it?
The links https://git-scm.com/docs/gitcredentials and git-lfs/wiki/Tutorial have perhaps something, but no objective solution.
Situation described by my git lfs env
,
git-lfs/2.4.0 (GitHub; linux amd64; go 1.8.3)
git version 2.7.4
LocalWorkingDir=
LocalGitDir=
LocalGitStorageDir=
LocalMediaDir=lfs/objects
LocalReferenceDir=
TempDir=lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
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"
and when I do git clone https://github.com/myPrivate/project1
the problem clonning process is not complete (bug), and was giving usernae and password all the time...
Problems also when try to do credentials (see issue #2223, etc.)
Trying report:
As mentioned in git-lfs issue 993:
Because the LFS server and the git server can be separate endpoints, it is possible that a user has permission for the git server but not the LFS server.
In this case, if there is a credential manager installed, the credentials will not be reset, and LFS will use them on each subsequent request without ever invalidating them.
You should check your git config credential.helper
output.
On Windows, it should be (with recent 2017-2018 Git releases) "manager".
Open the Windows Credential Manager and clear out or fix any GitHub credential entry.
Note: issue 2349 points out that Git-LFS had a problem to ask for credentials (in absence of an helper), because of a lack of pty/tty, but that has likely been fixed.
Transtating to dummies
(consolidating the answer and the comments)
Final notes about tests in many UBUNTU LTS servers... Sometimes, when you cloned before this procedure you can't fix the problem (git pull
erros like "git-credential-libsecret: not found"). The solution is to remove all old cloned repo (caution with rm -rf
). Seemingly you can do git config --global credential.helper
any time, so, do it. Clone again — perhaps giving username-and-password twice but will be fine after it.
这篇关于克隆gitlab项目,它始终使用git lfs而不提供密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!