SabreWolfy
SabreWolfy

Reputation: 5540

Adding credentials to a local git repository

I created a bare git repository on a (local) Windows network share (git file:// local protocol), cloned it on a Windows computer, added code, committed and pushed back to the remote repository.

How can I add username/password authentication credentials to this repository so that only I can push?

Upvotes: 1

Views: 600

Answers (1)

bk2204
bk2204

Reputation: 76519

In short, you can't. Git's username and password authentication relies on HTTP Basic authentication. If you don't have an HTTP server as an intermediary, then Git's authentication isn't going to work.

You can restrict the access to the network share or directory so only you can access it, which is a valid approach, but it won't require a username and password; instead, it will rely on you authenticating to the network share or having suitable directory permissions, which will be enforced on the server side as for any other directory.

Upvotes: 1

Related Questions