Closed asifashraf closed 2 years ago
Just add a check for type === 'fetch'
in the code that triggers your authentication:
const repositories = new Server(path.resolve(__dirname, 'tmp'), {
autoCreate: true,
authenticate: ({type, repo, user}, next) => {
if (type === 'push' || type === 'fetch') {
user((accountName, password) => {
console.log('Authenticating:', accountName, password)
if (accountName === '42' && password === '42') {
next()
} else {
next('wrong password')
}
})
} else {
next()
}
}
})
(To figure it out, you would log the type and then perform a git clone.)
Thanks for answering @aral, closing.
The authentication example on readme looks good for push commands. But I can clone any random name and this will create a new repo automatically anonymously? If auto creating is doing that which is great, where is authentication in that?