tl; dr:git checkout master没有切换到master分支,根本没有给出错误或任何输出,我也不知道为什么.任何其他分支工作正常.
我有一个git存储库,由分支development和master.我做了一个新的克隆存储库,检查分支development是默认的.
$ git clone <REPO-URL> --branch development
$ git branch -a
* development
origin/HEAD -> origin/development
origin/development
origin/master
$ git show-ref
656c781c2affc26792f857baf8e232de07101535 refs/heads/development
656c781c2affc26792f857baf8e232de07101535 refs/remotes/origin/HEAD
656c781c2affc26792f857baf8e232de07101535 refs/remotes/origin/development
cfee1a1761642453edf5d001565f23b50243ff09 refs/remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
ref master指向正确,提交确实存在并且是我的master分支的最新提交.
到目前为止,一切看起来都很正常,但是当我尝试切换到掌握时,这种情况正在发生:
$ git checkout master
$ git branch
* development
Run Code Online (Sandbox Code Playgroud)
没有来自结账的消息,没有错误,没有任何消息,并且没有切换分支.
到目前为止我尝试过的事情:
master2从同一个commit => checkout 创建第二个分支工作正常.git checkout -b master --track origin/master=>有效,但我认为没有必要使用此命令,因为这是git checkout master应该自动执行的操作还有什么想法?我错过了什么?我的存储库坏了吗?我怎样才能解决这个问题?
我希望我的 Spring Boot 应用程序能够为受保护的前端提供服务,并同时作为所述前端的 API 资源服务器,但我无法让 oauth 工作。
我想要的是 Spring Boot 应用程序在浏览器请求 index.html 而不带令牌时将 302 重定向返回到 oauth 服务器(在我的例子中是 gitlab),因此用户被发送到登录表单。但我也希望 API 在没有令牌的情况下调用 API 时返回 401,因为我认为 302 重定向到登录页面在那里不是很有用。
在伪代码中:
if document_url == /index.html and token not valid
return 302 https//gitlab/loginpage
if document_url == /api/restcall and token not valid
return 401
server document_url
Run Code Online (Sandbox Code Playgroud)
我正在使用 spring boot 2.1,关于 oauth 我的 pom.xml 包含
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我在 SecurityConfig 中的幼稚尝试
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) …Run Code Online (Sandbox Code Playgroud) 我想重用同一部分中定义的环境变量。
这不起作用
env:
HOST: example.com
URL: $HOST/foo.html
Run Code Online (Sandbox Code Playgroud)
它只会产生一个详细的“$HOST/foo.html”,而在使用时不会解析主机。
我也尝试过
env:
HOST: example.com
URL: ${{ env.HOST }}/foo.html
Run Code Online (Sandbox Code Playgroud)
这只是告诉我 无法识别的命名值:'env'