* Need support with git credential storage
@ 2016-01-27 21:49 Charles Bélanger
2016-01-27 22:28 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Charles Bélanger @ 2016-01-27 21:49 UTC (permalink / raw
To: git@vger.kernel.org
Hello Git Community,
I'm working at AddEnergie at Quebec city in Canada and I'm currently working on making a Build Server in a Virtual Machine running Ubuntu.
We are using git for our source code and I'm the first one here that need to use git store credentials for an Automated Build Server that would run overnight.
I'm wondering if you could provide me support about it because I'm having issue making it works.
The clue I have right now about my git store credential issue is when I'm doing a git clone of my project repo, I'm having following errors:
Here's the git clone command launch by a .sh script file called from ~/.profile:
git clone https://MyUserName@bitbucket.org/CompanyName/ProjectName.git ~/Projects/SubFolderName/ProjectName
Here's the error from bash .profile:
Fatal: unable to access 'https://MyUserName@bitbucket.org/CompanyName/ProjectName.git/':
Could not resolve host: bitbucket.org
I followed the excellent Web page here:
https://git-scm.com/book/be/v2/Git-Tools-Credential-Storage
Here's what I use as commands:
git credential-store --file ~/git.store store
protocol=https
host=bitbucket.org/CompanyName/ProjectName.git
username=MyUserName
password=MyPassword
(type enter on a blank line to exit)
git credential-store --file ~/git.store get
protocol=https
host=bitbucket.org/CompanyName/ProjectName.git
(type enter on a blank line to exit)
Here's what the ~/git.store file looks like:
https://MyUserName:MyPassword@bitbucket.org%2fCompanyName%2fProjectName.git
I tried changing the %2f by / inside the git.store file and also tried // but it's still showing the same fatal error.
Perhaps I don't use the host= property correctly.
May I ask you helping me with this ?
Best Regards,
Charles Belanger
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Need support with git credential storage
2016-01-27 21:49 Need support with git credential storage Charles Bélanger
@ 2016-01-27 22:28 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2016-01-27 22:28 UTC (permalink / raw
To: Charles Bélanger; +Cc: git@vger.kernel.org
On Wed, Jan 27, 2016 at 09:49:38PM +0000, Charles Bélanger wrote:
> Here's the git clone command launch by a .sh script file called from ~/.profile:
> git clone https://MyUserName@bitbucket.org/CompanyName/ProjectName.git ~/Projects/SubFolderName/ProjectName
>
> Here's the error from bash .profile:
> Fatal: unable to access 'https://MyUserName@bitbucket.org/CompanyName/ProjectName.git/':
> Could not resolve host: bitbucket.org
I don't think this is related to credentials. The credential code should
never do a network hostname lookup. It looks more like git-clone is
failing to contact the host in the first place.
Try "ping bitbucket.org", which would presumably yield the same error.
If so, you need to figure out why you cannot resolve the name, but
that's beyond the scope of this list.
> I followed the excellent Web page here:
> https://git-scm.com/book/be/v2/Git-Tools-Credential-Storage
>
> Here's what I use as commands:
> git credential-store --file ~/git.store store
> protocol=https
> host=bitbucket.org/CompanyName/ProjectName.git
> username=MyUserName
> password=MyPassword
> (type enter on a blank line to exit)
This comes from the "under the hood" section, I think. In normal use,
you shouldn't need to run the credential-helper directly. Just configure
it, via:
git config credential.helper "store --file ~/git.store"
The first time git needs a password, it will prompt you on the terminal,
and then store the result in that file.
If you do want to pre-seed the store, you can do so using a command like
the one above. But as you noted later, the "host" field should be _just_
the hostname, not the rest of the url path. That would go in the "path"
field if you want it, but typically git does not even bother to store
paths, and just keys on whole domains (see "credential.useHttpPath" in
"git help config" for more details).
You can also specify a URL using the special key "url", which is then
parsed into its components. So for example:
$ git credential-store --file my-store store
url=https://bitbucket.org/CompanyName/ProjectName.git
username=foo
password=bar
[blank line to end]
$ cat my-store
https://foo:bar@bitbucket.org/CompanyName/ProjectName.git
$ git credential-store --file my-store get
url=https://bitbucket.org/
[blank line ends our input, the rest is output]
username=foo
password=bar
> Here's what the ~/git.store file looks like:
> https://MyUserName:MyPassword@bitbucket.org%2fCompanyName%2fProjectName.git
>
> I tried changing the %2f by / inside the git.store file and also tried // but it's still showing the same fatal error.
> Perhaps I don't use the host= property correctly.
Right. It should be:
https://MyUserName:MyPassword@bitbucket.org/CompanyName/ProjectName.git
Though as before, you can omit "CompanyName/ProjectName.git" completely,
to cover the whole domain.
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-27 22:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 21:49 Need support with git credential storage Charles Bélanger
2016-01-27 22:28 ` Jeff King
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).