忽略“ appsettings.json”被上传到github

时间:2019-03-25 20:34:00

标签: git visual-studio github asp.net-core

我希望Visual Studio忽略将“ appsettings.json”上传到github存储库中。

我尝试将文件名放在.gitignore中,但Visual Studio 2017仍将其记录为更改并将其推送到存储库中

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

appsettings.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

我希望将更改推送到存储库时会忽略“ appsettings.json”。

1 个答案:

答案 0 :(得分:0)

与这里的问题相同:.gitignore isn't ignoring files in certain folder

protected $routeMiddleware = [
        'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'admin' => \App\Http\Middleware\AdminMiddleware::class,
        'dev' => \App\Http\Middleware\DevMiddleware::class,
        'cors' => \App\Http\Middleware\Cors::class, <----- 
    ];