直到最近我才使用过私有(private) Git 存储库。我无法从本地计算机访问我的私有(private)存储库。上个月,GitHub 更新了访问私有(private)存储库的方式。现在您无法使用您的用户名和密码。当我尝试使用个人访问 token 时,我收到以下消息:remote: 未找到存储库。致命:找不到存储库“https://github.com/[Org]/[Repo].git/”
。
我已经初始化了我的本地存储库。现在我只需要将它连接到我的私有(private)远程存储库。我想使用我的个人访问 token 而不是 ssh。
以下是我在 Windows 上使用的命令:
git remote add origin https://[UserName]:[Token]@github.com/[Org]/[Repo].git
git add .
git commit -m "Commit" ---> Output: On branch master nothing to commit, working tree clean
git push --set-upstream origin master ---> Output: Gives me the error
最佳答案
我认为您的说法“上个月,GitHub 更新了您访问私有(private)存储库的方式。现在,您不再使用密码,而是使用个人访问 token 。”完全不正确。你可以做到,对吧。
要使用 token ,请添加您的存储库网址,如下所示:
git remote add origin https://[Token]@github.com/[Org]/[Repo].git
关于git - 无法使用个人访问 token 访问私有(private) Git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69326011/