小编C-R*_*RAD的帖子

尽管身份验证成功,但无法克隆存储库

我在 Mac 上尝试克隆我在另一台机器上使用私人 github 帐户创建的存储库。

我完成了典型的 ssh 关键步骤,但无论出于何种原因,我仍然无法使用 ssh 进行克隆。

当我跑步时:

ssh -T git@github.com-<private account> 
Run Code Online (Sandbox Code Playgroud)

我明白了

Hi <private account>! You've successfully authenticated, but GitHub does not provide shell access.
Run Code Online (Sandbox Code Playgroud)

我的~/.ssh/config

Host github.com
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa
 IdentitiesOnly yes

Host github.com-<private account>
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa_****
 IdentitiesOnly yes
Run Code Online (Sandbox Code Playgroud)

当我克隆时:

Cloning into 'my repo'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists. …
Run Code Online (Sandbox Code Playgroud)

git ssh github

5
推荐指数
1
解决办法
1309
查看次数

当使用 jest 运行时,应用程序不会在 History.push 上重新渲染

我正在尝试使用 jest 和 react-testing-library 测试我的 LoginForm 组件。当登录表单成功提交时,我的handleLoginSuccess函数应该在localStorage上设置“用户”项,并使用history.push()将用户导航回主页。这在开发环境中的浏览器中有效,但是当我使用 Jest 渲染组件并模拟 API 时,localStorage 会更新,但不会导航到“/”。

我尝试在调用history.push()之前设置localStorage。我不确定在这种情况下是什么负责重新渲染,以及为什么它在开发中有效但在测试中无效。

登录.test.jsx

import 'babel-polyfill'
import React from 'react'
import {withRouter} from 'react-router'
import {Router} from 'react-router-dom'
import {createMemoryHistory} from 'history'
import {render, fireEvent} from '@testing-library/react'
import Login from '../../pages/Login'
import API from '../../util/api'

jest.mock('../../util/api')


function renderWithRouter(
  ui,
  {route = '/', history = createMemoryHistory({initialEntries: [route]})} = {},
) {
  return {
    ...render(<Router history={history}>{ui}</Router>),
    // adding `history` to the returned utilities to allow us
    // to reference it in our …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs react-router react-testing-library

4
推荐指数
1
解决办法
2750
查看次数