-1

i can't push my code to github. i have an existing repo and some code on github and its newer version on pc and i would like to push code from pc to github but my visual studio disconnected from my repo. When I was looking for solutions, I only found guides on how to create a new repository or how to download them from github. Thanks in advance for your help

I tried to look for a solution in the team explorer tab but there is only information that the repository functions have been moved

1 Answers1

1

The mechanism that git uses to connect your local repository with a remote repository is called git remote.

You can view the existing configuration by running

git remote -v

For github specifically you want the configuration to be on form

origin  git@github.com:username/reponame.git (fetch)
origin  git@github.com:username/reponame.git (push)

for ssh key authenticated access, and not

origin  https://github.com/username/reponame (fetch)
origin  https://github.com/username/reponame (push)

Could perhaps this be the reason you are unable to push?


You can have multiple remote entries. You are even able to add repos that do not share a common history. In that case the commits from the "other" repo is not direcly reachable but you are fully able to cherry-pick those (assuming the same file(s) are modified), and you can create branches on that can be rebased onto your main repo.

hlovdal
  • 26,565
  • 10
  • 94
  • 165