I've never used a private Git repo until recently. I'm having trouble with gaining access to my private repo from my local machine. Last month, GitHub updated the way you access private repositories. Now you can't use your username and password. I'm given this message when I try with the personal access token: remote: Repository not found. fatal: repository 'https://github.com/[Org]/[Repo].git/' not found
.
I've already initialized my local repository. Now I just need to connect it to my private remote repository. I'd like to use my personal access token instead of ssh.
Here are the commands I'm using on 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
CodePudding user response:
I don't think your statement "Last month, GitHub updated the way you access private repositories. Now, instead of using your password, you use a personal access token. " is true at all. You can do that, right.
To use the token add your repo url like so:
git remote add origin https://[Token]@github.com/[Org]/[Repo].git
CodePudding user response:
So the main takeaway from my issue is to make sure the role you're assigned is allowed to push to the private repository. My team and I assumed that an admin would be able to push, but that doesn't seem to be the case. Also, you can use either of these for your origin:
https://[Token]@github.com/[Org]/[Repo].git
or
https://[UserName]:[Token]@github.com/[Org]/[Repo].git