简体   繁体   English

从 git 中的远程存储库推送更改

[英]Pushing Changes from a Remote Repository in git

To practice git, I created a git user and a bare repository in the directory /home/gituser/project.git .为了练习 git,我在目录/home/gituser/project.git中创建了一个 git 用户和一个裸存储库。 I created a new user and sshkeys stored in /home/Tom/.ssh .我创建了一个新用户和 sshkeys 存储在/home/Tom/.ssh中。 I have added the origin master for gituser in user Tom .我在用户Tom中添加了gituserorigin master

I added a readme file, staged it, and committed the changes.我添加了一个自述文件,暂存它,并提交了更改。 While trying to push changes with push origin master , I got this error:尝试使用push origin master推送更改时,出现此错误:

ssh: connect to host desktop-avnq82i port 22: Connection refused fatal: Could not read from remote repository. ssh:连接到主机 desktop-avnq82i 端口 22:连接被拒绝致命:无法从远程存储库读取。 Please make sure you have the correct access rights and the repository exists.请确保您具有正确的访问权限并且存储库存在。

How would I be able to fix this problem?我将如何解决这个问题? Both of the users have admin permissions on ubuntu 20.04 app in Windows 10 and only the gituser is in a group: dev .两个用户都对 Windows 10 中的 ubuntu 20.04 应用程序具有管理员权限,并且只有gituser在一个组中: dev

Note that both the users are on the same computer.请注意,两个用户都在同一台计算机上。

Have you tried added remote repo using git?您是否尝试过使用 git 添加远程仓库?

steps to follow要遵循的步骤

git init

git add .

git commit -m "first commit"

git branch -M main

git remote add {url-of-new-git-repo}

asks for username and pwd create a pat token as password is not longer accepted.要求用户名和密码创建一个 pat 令牌,因为不再接受密码。

also try adding the git to known hosts file.还可以尝试将 git 添加到已知主机文件中。

refer below url for more info请参阅下面的 url 了解更多信息

https://gist.github.com/Tamal/1cc77f88ef3e900aeae65f0e5e504794 https://gist.github.com/Tamal/1cc77f88ef3e900aeae65f0e5e504794

ssh: connect to host github.com port 22: Connection timed out ssh:连接到主机 github.com 端口 22:连接超时

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM