简体   繁体   English

将下载的git存储库推送到分支机构主服务器

[英]push downloaded git repository to branch master

I downloaded a project of mine at GitHub (downloaded zip, not git clone ). 我在GitHub下载了我的一个项目(下载了zip,而不是git clone )。

I made some changes and now I want to commit and push it to origin master, how should I proceed? 我进行了一些更改,现在我要提交并将其推送给Origin Master,我应该如何进行? Always I do this, I find some workaround to push, so I'd like to know the correct way. 我总是这样做,我发现一些解决方法,所以我想知道正确的方法。

I guess I should do 我想我应该做

git init
git add .
git commit -m "some message"
git remote add origin [repository_link]
git pull -u origin master
git push -u origin master

but I'm not sure. 但我不确定。

If you want to push back to a repository, you should clone it instead of downloading it. 如果要推回存储库,则应clone它而不是downloading它。

That being said, I understand the issue here is that you downloaded it and didn't realize that when you made the changes. 话虽如此,我理解这里的问题是您下载了它,但在进行更改时并没有意识到。

I would suggest to clone the project into a different folder. 我建议将项目克隆到另一个文件夹中。 Then you can replace all files from the old downloaded folder to the new cloned folder. 然后,您可以将所有文件从旧的下载文件夹替换为新的克隆文件夹。

Do a git status and git diff to make sure everything looks good. 做一个git statusgit diff来确保一切看起来不错。

Now you can git push origin master 现在您可以git push origin master

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

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